rtMedia Photos as default tab in profiles


#1

I would like that, once opened a personal profile page, the default tab was media>photos instead of activity, I can I do that? Thanks


#2

Hi Rico,
I am sorry to say it is not possible right now as rtMedia isn’t BuddyPress component. Redirection rules can help you to achieve this.


#3

Hi riteshpatel,

In the first place, thank you for this great plugin!

I’m very frustrated with this issue. Do you have any suggestion on how to do the redirection? On the other hand I was trying to add the shortcode in the profile tab but couldn’t figure out how to set the user id… What would you say it’s the best solution to this problem?

Thank you and sorry for reviving this post :slight_smile:


#4

Hello @Chus_Asensio,

User id can be get from the function ‘bp_displayed_user_id()’ in the profile. Hope this will help you. Let us know if you have any other doubts.

Thank you.


#5

Thank you @pranalipatel! I’m going to try it and let you know if it works. Just one doubt: is the user id the same for rtmedia and buddypress? Because I’m going to use the rtmedia shortcode for gallery. It will be something like:

[rtmedia_gallery global=“false” media_author="<?php echo ( bp_displayed_user_id() ) ?>"]

I’m not in my computer so I can’t test it right now but do you think it’ll work this way?


#6

Didn’t work with the shortcode. I’m very rookie with php and wp so it’s hard for me.

Thank you anyways!


#7

Hello @Chus_Asensio,

‘bp_displayed_user_id()’ will help you to get currently displayed user for user profile you are visiting. For site wide pages for example global activity page you should not use this function as it doesn’t fetch currently logged in user and global activity contains posts from all the users. But as you want to use shortcode in profile tab, you can use ‘bp_displayed_user_id()’ function.

Regarding shortcode, you need to create custom template page to call shortcode manually.

Create a page template. Get current displayed user id ( i.e. $user_ID = bp_displayed_user_id(); )

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

Let us know if you have any doubt or question on this.

Thank you.


Another buddypress query
#8

Thank you for your answer @pranalipatel!

I’m trying with the profile-loop in buddypress > members > single > profile > profile-loop.php I’m trying with this code but I get this error message: Oops !! There’s no media found for the request !!

<?php $user_ID = bp_displayed_user_id(); ?>
<?php do_action( 'bp_before_profile_loop_content' ); ?>

<?php if ( bp_has_profile() ) : ?>

	<?php while ( bp_profile_groups() ) : bp_the_profile_group(); ?>

		<?php echo do_shortcode('[rtmedia_gallery global="false" media_author="'.$user_ID.'"]'); ?>

	<?php endwhile; ?>

<?php endif; ?>

<?php do_action( 'bp_after_profile_loop_content' ); ?>

Thank you very much for your time :slight_smile:


#9

Hello @Chus_Asensio,

Please try adding below shortcode:

<?php echo do_shortcode('[rtmedia_gallery global="true" media_author="'.$user_ID.'"]'); ?>

We hope you have overridden BuddyPress templates. Let us know if this works for you.

Thank you.


#10

Woohooooooo! It worked! Thank you so so much!

So in case someone else need it, this is what a finally did:

As rtMedia isn’t a Buddypress component, it’s imposible to set ‘media’ as the default tab with the standard define('BP_DEFAULT_COMPONENT', 'media' );

So I modified the Buddypress single profile loop to add the rtMedia shortcode to display the ‘media’ items there. The file is in buddypress > members > single > profile > profile-loop.php

And the code is:

<?php $user_ID = bp_displayed_user_id(); ?>
<?php do_action( 'bp_before_profile_loop_content' ); ?>

<?php if ( bp_has_profile() ) : ?>

	<?php while ( bp_profile_groups() ) : bp_the_profile_group(); ?>

		<?php echo do_shortcode('[rtmedia_gallery global="true" media_author="'.$user_ID.'"]'); ?>

	<?php endwhile; ?>

<?php endif; ?>

<?php do_action( 'bp_after_profile_loop_content' ); ?>

Thank you so much for your help @pranalipatel :slight_smile:


Attach images to comments
#11

Hello @Chus_Asensio,

Glad to know that your issue has been solved. You are welcome! :slight_smile:

I am closing this thread now. Feel free to create a new thread if you have any other issues or doubts.

Thank you.


#12