BuddyDev

Reordering BuddyPress User Profile tabs

BuddyPress 2.6.0 introduced simpler ways to organize nav items. If you are looking for ways to reorder, It is very simple.

Before we dive into code, some basics first.

BuddyPress uses numeric position as a way to sort the nav items. The nav items are ordered in ascending order(lower values come first). We can use the edit_nav() method of the BP_Core_Nav class to update the position.

To update the position of a user profile nav item,  you can use the following code

Please make sure to change the $nav_slug with the actual nav item slug and the $new_position with a number.

In the function, the first argument is the details we want to update and the second argument is the slug of the nav item.

Example:-

Here is a complete example of reorganizing multiple profile tabs. It is not necessary to reorder all tabs, you may only order the relevant tabs for you.

And the result:-

Please update the position as you wish. You should put the in your bp-custom.php.

Have fun!

6 Responses to Reordering BuddyPress User Profile tabs

  • People could also use the free BuddyPress Reorder Tabs plugin from BuddyBoss. Works just fine, and can also reorder tabs for groups.

    • Hi Nathan,
      Thank you for the comment.
      The BuddyBoss Reorder Tabs plugin is buggy. It overwrites all tabs. I am not sure if it works properly now. But I remember it causing me a headache as it almost overtook the tabs and some new custom tabs disappeared because of it.

      Also, the plugin is bulky and I don't see any point in using the plugin if you are a developer. The code is aimed at developer.
      As for groups, you can adapt the same code for groups, all you need to change is buddypress()->members->nav to buddypress()->groups->nav;

  • Can you also do this to completely delete some of these tabs? Rather than hiding it via CSS?

    • Hi Graham,
      My apologies for the delayed reply.
      You can use the same action to delete a link. All you need to do is use this function

      and for sub navs

      Please make sure you don't delete the default sub nav. It is problematic.

      Regards
      Brajesh

  • Aly #

    Is there a way to move the items underneath another tab. For example i want to move settings and notifications under profile.

    • Hi Aly,
      You can do that by using css to hide the notification tab and adding the link to current user's notification as child of the profile.

      Please do not remove the notification link using the code for nav removal or the screens will break.