Tagged: buddypress, default components, logged in user, profile
Hello BuddyDev,
I have another question! I’m trying to distinguish between the logged in user and a members profile they are viewing. il explain.
Id like to be able to say
IF the CURRENT USER is viewing THEIR profile THEN display the forum index ELSE IF the CURRENT USER is viewing SOMEONE ELSES profile THEN display PERSONS PROFILE INFORMATION…
I have something like this
function lg_pick_menu () { if ( bp_is_user() ) { define ( "BP_DEFAULT_COMPONENT", "social"); } else { define ( "BP_DEFAULT_COMPONENT", "activity"); } }
The only thing I can get that code to do though is some how remove a few links from my menu. I imagine I’m using the function from BuddyPress wrongly but finding documentation that is easily understandable is becoming frustrating.
Thanks!
PhilB
Hi Phil,
Please give it a try.function buddydev_set_default_menu () { if ( bp_is_my_profile() ) { define ( 'BP_DEFAULT_COMPONENT', 'activity' ); } else { define ( 'BP_DEFAULT_COMPONENT', 'profile' ); } } add_action( 'bp_init', 'buddydev_set_default_menu', 0 );
Please put it in your bp-custom.php and let me know if it works for you or not?
Thank you
Brajesh
You must be logged in to reply to this topic.