Is there any shortcode for own upload images?


Is there any shortcode which show for each user all his uploaded images?

Hello @alexsilva,

User can also find his own uploaded media at {site}/members/{user}/media/ .

Shortcode for the same is : [rtmedia_gallery context=profile context_id=5] // where context_id = user_id

For each user we can’t find user id in one shortcode. We need to pass current user_id and that will differ for every logged-in user. We need to get current logged-in user of the page which can be passed to fetch page media.

So, we can not use predefined shortcode to pass dynamic user_id.

Instead, you need to call shortcode manually. Technically you need to follow below steps :

  • Create a page template.

  • Get current logged-in user ( i.e. $user_ID = get_current_user_id(); )

  • Call gallery shortcode from page template by passing user-id. ( i.e. echo do_shortcode(’[rtmedia_gallery context=“profile” context_id="’.$user_ID.’"]’);)

Hope this helps you. Thank you.

Thank you very much for your reply. Did this also show all pics even if its uploaded in groups?

Hello @alexsilva,

No, this shortcode works only for user profile media. If you want to show all global media then you can go for below ShortCode:

[rtmedia_gallery global=true media_author=1]

Note: media_author id #1 is respective user_id.