Merci @imath !
The old way
The following syntax to change the tab order is deprecated since 2.6 and will throw an error notice:
function rt_change_profile_tab_order() {
global $bp;
$bp->bp_nav['profile']['position'] = 10;
$bp->bp_nav['activity']['position'] = 20;
}
add_action( 'bp_setup_nav', 'rt_change_profile_tab_order', 999 );
The new way
Now the correct syntax to use for modifying – since 2.6 – the tabs position on the buddybar when you’re on a profile.
This example list all BP related items who appear by default on a profile nav, in order of appearance and include also the forum tab (if you use bbPress for group forums).
By default, activity tab comes as 1st. The snippet will move it to 4th position.
To modify a position you simply change the numeric value.
If you want to move only one item, you remove or comment (add //
at begin of the line) the ones you don’t want to move.
function bpex_primary_nav_tabs_position() {
buddypress()->members->nav->edit_nav( array( 'position' => 4, ), 'activity' );
buddypress()->members->nav->edit_nav( array( 'position' => 5, ), 'profile' );
buddypress()->members->nav->edit_nav( array( 'position' => 7, ), 'notifications' );
buddypress()->members->nav->edit_nav( array( 'position' => 9, ), 'messages' );
buddypress()->members->nav->edit_nav( array( 'position' => 2, ), 'friends' );
buddypress()->members->nav->edit_nav( array( 'position' => 6, ), 'groups' );
buddypress()->members->nav->edit_nav( array( 'position' => 3, ), 'forums' );
buddypress()->members->nav->edit_nav( array( 'position' => 1, ), 'settings' );
}
add_action( 'bp_setup_nav', 'bpex_primary_nav_tabs_position', 999 );
That’s it for the buddybar nav menu order on profile.