Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reorder or rearrange buddypress menu items


  • pratibhasvaksha
    Participant

    @pratibhasvaksha

    Can anyone please help me rearranging the BuddyPress menu items. I’ve tried using the below code but it’s not working.I’ve added this code in my child theme’s functions.php but I don’t see any changes.

    function bbg_change_profile_tab_order() {
    global $bp;
    
        $bp->bp_nav['profile']['position'] = 10;
        $bp->bp_nav['activity']['position'] = 20;
        $bp->bp_nav['blogs']['position'] = 30;
        $bp->bp_nav['friends']['position'] = 40;
        $bp->bp_nav['messages']['position'] = 50;
        $bp->bp_nav['groups']['position'] = 60;
        $bp->bp_nav['settings']['position'] = 70;
    }
    add_action('bp_setup_nav', 'bbg_change_profile_tab_order', 999 );
Viewing 5 replies - 1 through 5 (of 5 total)

  • Varun Dubey
    Participant

    @vapvarun

    @pratibhasvaksha You can check the following doc

    Navigation API


    pratibhasvaksha
    Participant

    @pratibhasvaksha

    Hi Varun,
    Thanks for the reply. The navigation API does not solve my problem. I don’t want to change the inner pages navigation menu. I want to rearrange the menu items in the header under the user profile picture.

    Rearranging the below menu:

    1. Dashboard
    2. Profile
    3. Notifications
    4. Messages
    5. Friends
    6. Groups
    7. Settings
    8. Logout

    to the this menu:

    1. Dashboard
    2. Groups
    3. Notifications
    4. Messages
    5. Friends
    6. Profile
    7. Settings
    8. Logout

    Venutius
    Moderator

    @venutius

    One option would be to use BP Nouveau, it comes with a customizer option to reorder the Nav items.


    pratibhasvaksha
    Participant

    @pratibhasvaksha

    Hi @venutius,
    Thanks for the reply. Could you please elaborate a bit? Are you talking about this function and how we access it using a filter/action?

    function bp_nouveau_set_nav_item_order( $nav = null, $order = array(), $parent_slug = '' ) {
    	if ( ! is_object( $nav ) || empty( $order ) || ! is_array( $order ) ) {
    		return false;
    	}
    	$position = 0;
    	foreach ( $order as $slug ) {
    		$position += 10;
    		$key = $slug;
    		if ( ! empty( $parent_slug ) ) {
    			$key = $parent_slug . '/' . $key;
    		}
    		$item_nav = $nav->get( $key );
    		if ( ! $item_nav ) {
    			continue;
    		}
    		if ( (int) $item_nav->position !== (int) $position ) {
    			$nav->edit_nav( array( 'position' => $position ), $slug, $parent_slug );
    		}
    	}
    	return true;
    }

    Venutius
    Moderator

    @venutius

    Not specifically, I’m just mentioning that for Nouveau if you go to customizer>BP nouveau>Member Navigation you can drag and drop the nav order

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar