BuddyDev

Search

Default componenents and logged in user.

  • Participant
    Level: Initiated
    Posts: 12
    Phil B on #3805

    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

  • Participant
    Level: Initiated
    Posts: 12
    Phil B on #3806

    Sorry to bump straight away. I’m not trying to bump this. Just wanted to say I’m aware that code currently says ‘activity’ and I want profile. that was just an example. Also I can provide screen shots of what I mean about the nav links disappearing. thanks!

  • Keymaster
    (BuddyDev Team)
    Posts: 24583
    Brajesh Singh on #3822

    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.

This topic is: not resolved