Skip to:
Content
Pages
Categories
Search
Top
Bottom

hide bp sub nav name.


  • yadigit
    Participant

    @yadigit

    good morning everyone.
    I created a new nav and subnav on the profile page.
    Works great! Only problem im having now is hiding the subnav names.

    I know if I use
    'show_for_displayed_user' => false,
    it will hide it only if the profile is not their own..

    But how do I hide it completely from the subnav? Regardless if the profile is yours or not.

    Thank you in advance!

Viewing 4 replies - 1 through 4 (of 4 total)

  • U2BSeen
    Participant

    @u2bseen

    Hi yadigit

    I was wondering if you found a solution to your problem?

    I would like to do something similar except I would like the subnav item to be visible only if it is your profile. Everybody else should not be able to see it.

    Ian


    danbp
    Participant

    @danbp

    you apply a condition to bp_core_remove_subnav_item function.

    2 function to do that.
    1) define the condition
    2) remove the nav/subnav item

    
    function bpfr_hide_nav() {
    	$retval = false;
    	
    	if ( bp_is_user() && ! bp_is_my_profile() ) {
    		$retval = true;
    	}	
    	return $retval;
    }
    
    function bpfr_hide_profile_nav() {
    	
    	// stop if condition is not filed
    	if ( ! bpfr_hide_nav() ) {
    		return;
    	}
    	bp_core_remove_nav_item( 'friends' ); // bp topnav
    	bp_core_remove_subnav_item( 'activity', 'friends' ); //bp subnav (my activities, my groups, etc)
    }
    add_action( 'bp_ready', 'bpfr_hide_profile_nav' );

    Add this to bp-custom.php


    U2BSeen
    Participant

    @u2bseen

    Thank you so much danbp – I have been looking for this solution for a while now. Time for testing and the inevitable features creep that this opens up for me.

    Thank you


    danbp
    Participant

    @danbp

    You’re welcome ! 😉

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘hide bp sub nav name.’ is closed to new replies.
Skip to toolbar