Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Removing nav & subnav item in profile page


  • had_hc
    Participant

    @had_hc

    So now that there’s this new Navigation API, the nav item and the subnav item that i’ve hidden before are now visible again after updating to latest Buddypress 2.6.
    As a reference, here’s how I did this before;

    function my_setup_nav() {
          global $bp;
    	$bp->bp_nav['vendor-dashboard']['position'] = 7;
    	$bp->bp_nav['my-store']['position'] = 9;
    	$bp->bp_nav['shopping']['position'] = 8;
    	$bp->bp_nav['follow-store']['position'] = 10;
    
    	// Remove a menu item
            $bp->bp_nav['events'] = false;
            $bp->bp_options_nav['shopping']['view_order']= false;
    }
    add_action( 'bp_setup_nav', 'my_setup_nav', 1000 );

    The repositioning still works, but as said above, removing the subnav doesn’t work anymore. I’m quite a noob in programming to be honest. I’ve looked at the page linked by the changelog but I have no idea how to do it with the ‘new method’. Can anybody help a noob here please? Thanks in advance!

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

  • sharmavishal
    Participant

    @sharmavishal

    try this and let me know if it works in bp 2.6 for u or not

    function my_remove_em_nav() {
    	global $bp;
          bp_core_remove_nav_item( 'events' );
          bp_core_remove_subnav_item( 'settings', 'profile' );
    
    }
    add_action( 'bp_init', 'my_remove_em_nav' );

    had_hc
    Participant

    @had_hc

    Great! It worked! Thanks for that!


    sharmavishal
    Participant

    @sharmavishal

    Enjoy


    javierllinas
    Participant

    @javierllinas

    Hello,

    Works really nice, thank you!

    Do you now how to remove those items from user menu (top right dropdown)?

    Thanks in advance.


    danbp
    Moderator

    @danbp

    hi @javierllinas

    You can use something like this (add to bp-custom.php or child theme’s functions.php)

    BuddyPress usermenu usage: remove_node(‘$id-$nav-$subnav’)

    /* remove items from Toolbar Usermenu (top-right) */
    function bpex_admin_bar_remove_this(){
    global $wp_admin_bar;
    	$wp_admin_bar->remove_node('my-account-forums-favorites');
    	$wp_admin_bar->remove_node('my-account-messages-starred');
            // etc...
    }
    add_action('wp_before_admin_bar_render','bpex_admin_bar_remove_this');

    Reference


    javierllinas
    Participant

    @javierllinas

    Thank you very much, @danbp !

    Best,
    Javier


    danbp
    Moderator

    @danbp

    You’re welcome! 😉

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] Removing nav & subnav item in profile page’ is closed to new replies.
Skip to toolbar