Customize profile and group menus in BuddyPress

This is a short article about menu tweaking in profiles and groups.

It took me a while to find all the answers, that’s why I bring all together here, so you do not need to search again.

Starting with the profiles

1. Change the menu order in the profile

If you like to change the menu order in your profile pages, you will need to create a bp-custom.php in your plugin directory. Just create the new file inside the folder wp-content/plugins.

Add the following function to the bp-custom.php:

`pre type=”php”`
function bbg_change_profile_tab_order() {
global $bp;

$bp->bp_nav[‘profile’][‘position’] = 10;
$bp->bp_nav[‘activity’][‘position’] = 20;
$bp->bp_nav[‘friends’][‘position’] = 30;
$bp->bp_nav[‘groups’][‘position’] = 40;
$bp->bp_nav[‘blogs’][‘position’] = 50;
$bp->bp_nav[‘messages’][‘position’] = 60;
$bp->bp_nav[‘settings’][‘position’] = 70;
}
add_action( ‘bp_setup_nav’, ‘bbg_change_profile_tab_order’, 999 );
`/pre`

The number is for the position of the menu. If you have plugins installed, who add their own menu item into your profile nav, use the slug of the component to manipulate the position.

For example if you have events or a gallery nav item, it would be something like this:

`pre type=”php”`

$bp->bp_nav[‘events’][‘position’] = 40;
$bp->bp_nav[‘gallery’][‘position’] = 50;

`/pre`

2. Rename a menu item

Add the following line to the function and change the activity to what ever you want to rename:

`pre type=”php”`

$bp->bp_nav[‘activity’][‘name’] = ‘wall’;

`/pre`

3. Remove a menu item

If you want to remove a nav item, add this line to the function and change activity to whatever you want to remove:

`pre type=”php”`

$bp->bp_nav[‘activity’] = false;

`/pre`

Have a look at the forum post where I got the most info from:

http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/customizing-buddypress-profile-page-default-tab-and-item-nav-order/

Now we go to the groups

1. Change the menu order in groups

If you like to change the menu order in your profile pages, you will need to create a bp-custom.php in your plugin directory. If you already have a bp-custom.php, just add the function at the end before the “?>”

`pre type=”php”`
function my_bp_groups_forum_first_tab() {
global $bp;

$bp->bp_options_nav[‘groups’][‘home’][‘position’] = ’50’;
}
add_action(‘wp’, ‘my_bp_groups_forum_first_tab’);
`/pre`

http://pastebin.com/eTNKwgCR

This function works exactly the same way, like the profile function works. The number is the position.
In this function we just move the home item. Adding more lines like in the profile function above depends on what nav items you have in your group.

2. Set the forum nav item as the default nav item in groups

To make the forum your home tab of the group, paste the following in /wp-content/plugins/bp-custom.php:

`pre type=”php”`
function redirect_to_forum() {
global $bp;

$path = clean_url( $_SERVER[‘REQUEST_URI’] );

$path = apply_filters( ‘bp_uri’, $path );

if ( bp_is_group_home() && strpos( $path, $bp->bp_options_nav[‘groups’][‘home’][‘slug’] ) === false )
bp_core_redirect( $path . $bp->bp_options_nav[‘groups’][‘forum’][‘slug’] . ‘/’ );
}
add_action( ‘wp’, ‘redirect_to_forum’ );
`/pre`

http://pastebin.com/j3n17CVe (you’ll probably need to tweak the code for BP subdomain installs!)

3. Rename a nav item

If you want to rename a nav item, copy this line to the my_bp_groups_forum_first_tab function. This example will change “Home” to “Something”.

`pre type=”php”`

$bp->bp_options_nav[‘groups’][‘home’][‘name’] = ‘Something’;

`/pre`

4. Remove a nav item

Add this line to the my_bp_groups_forum_first_tab function to remove the home item. Change the home to your needs:

`pre type=”php”`

$bp->bp_options_nav[‘groups’][‘home’] = false;

`/pre`

Have a look at the forum post where I got the most info from:

http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/changing-group-tab-display-defaults/#post-55449

66 thoughts on “Customize profile and group menus in BuddyPress

  1. Hi Sven

    a lot of really helpful stuff here all in one place, thanks.

    As buddypress menu guru, maybe you know if something I’m trying to do is even possible: from elsewhere can you link directly to a sub-menu. For example, somewhere on my site I want a link to go directly to the forum page, somewhere else a link to go directly to the members list etc. So I’m not talking about hard-coding a new home page, for example. Any ideas?

    Thanks!

  2. Thanks for the article. However I am not a techie. Yet, I am trying hard to understand. I am looking to create custom fields for BP Groups as like as in BP user profiles. For instance, I wish to create fields such as Name, Location, Postal Code to my Groups. Admins should be able to edit it. Please guide me to achieve these things. Thanks in advance.

  3. I notice that the function for the profile tab groups is bp_nav while groups is bp_options_nav. Anyone know of a list of these for all of the tab groups in BP? We really should be able to customize any tab group in BP, and I think all that’s missing is the references for the functions.

  4. Profile photo of svenl77

    Update: I have created tow new functions for handling the menu tap order in groups and profiles.

    Its much easier as explained in this article

    Have a look here https://gist.github.com/970170

    • Please how can I Add the component slugs coma separated in the order you like to have the nav menu tabs? Can you give me an example.

  5. Brilliant! I have been trying to figure out how to make changes to the groups and this is nice and simple and exactly what I was looking for. Thanks

  6. Is there a way to add a class and title attribute to a group or profile item using this method? I would like to add a javascript popup to my menu items because I’ve changed them to icons similar to Google Plus’s menu at the top. Any ideas?

  7. Profile photo of nosy

    @svenl77 Great article! One question: Set the forum nav item as the default nav item in groups works fine, but what’s about the settings? Users are able to disable the forum. Then it doesn’t work anymore. What’s to do to remove the forum function from the settings?

  8. @svenl77 Thanks for the article! I’m using the budyboss theme and the function added an extra slot but there’s nothing in the slot. just a space between two lines. How and what do i edit to change this?

    • Profile photo of konrads

      I know you can do this for group profiles right now:
      http://themekraft.com/buddypress-docs-add-doc-to-nav/

      but also have a deeper look in the BP plugin repository, maybe you find a plugin for exactly your needs. otherwise to would have to step into the code…

      konrad

  9. Little confused.. what should that bp-custom.php entirely?
    Does it need the rest of the page formatting too? or just open php – put that snippet in there – and that’s it?

    : / sorry – total noob with editing in Buddypress

  10. * for me the problem was that copy/pasting from the post resulted in curly quotes that i had not noticed :) replaced them and BAM . thank you!

  11. hey guys, this is probably a really stupid question, but how do I change the layout of the home page? I want just simple text on it!! thanks

  12. Profile photo of konrads

    have a look in the FAQ for custom homepage:
    http://themekraft.com/faq/making-a-custom-homepage/

    checkout the support forums for support: http://themekraft.com/forums/

    have a nice day, konrad

  13. helo i wana costomise my profile buddypress for add a menu for visiter of my profil to post a message or comments.
    can you help me?

  14. Awesome Share! I am having to add css class to the menu item though. I added this to my bp-custom.php with no avail:

    function bbg_change_profile_css() {
    global $bp;

    $bp->bp_options_nav[‘profile’][‘css_id’];
    }
    add_action( ‘bp_setup_nav’, ‘bbg_change_profile_css’, 999 );

    Any help?

  15. OK. I tried this and it works, but it changes the id, but I wanted to add class, not id:

    function bbg_change_profile_css() {
    global $bp;

    $bp->bp_nav[‘friends’][‘css_id’] = ‘new_css’;
    }
    add_action( ‘bp_setup_nav’, ‘bbg_change_profile_css’, 999 );

    Do you know how to add class to the menu item?

  16. Hi great article! Taking this concept one step further can you delete/rename subnav Profile Menu items in the same way?

    $bp->bp_nav[‘profile’][‘public’] = false;?

    (tried with no avail) Any helpful advice on this would be helpful.

    • I’m having the same issue, I created this topic in the WordPress support forums looking for guidance but there’s been no replies so far: http://wordpress.org/support/topic/buddypress-groups-optimization

    • Code needs to be updated for newer version of buddypress and wordpress. Try a version of this:

      bp_options_nav[$bp->groups->current_group->slug][‘home’][‘slug’] ) === false ) {
      if ($bp->groups->current_group->is_user_member || $bp->groups->current_group->status == ‘public’) {
      bp_core_redirect( $path . ‘forum/’ );
      }
      }
      }
      function move_group_activity_tab() {
      global $bp;
      if (isset($bp->groups->current_group->slug) && $bp->groups->current_group->slug == $bp->current_item) {
      $bp->bp_options_nav[$bp->groups->current_group->slug][‘home’][‘position’] = ’98’;
      $bp->bp_options_nav[$bp->groups->current_group->slug][‘home’][‘name’] = ‘Something’;
      }
      }
      add_action(‘bp_init’, ‘redirect_group_home’ );
      add_action(‘bp_init’, ‘move_group_activity_tab’);
      ?>

  17. Just changing the action call seemed to work for me upgrading to 1.5

    function redirect_to_forum() {
    global $bp;

    $path = clean_url( $_SERVER[‘REQUEST_URI’] );

    $path = apply_filters( ‘bp_uri’, $path );

    if ( bp_is_group_home() && strpos( $path, $bp->bp_options_nav[‘groups’][‘home’][‘slug’] ) === false )
    bp_core_redirect( $path . $bp->bp_options_nav[‘groups’][‘forum’][‘slug’] . ‘forum/’ );
    }
    add_action( ‘bp_init’, ‘redirect_to_forum’ );

  18. Does anyone know how to remove the “All Groups” or “My Groups” tab from the default BP theme when viewing Groups? To clarify, when you go to the groups page you have the tabs “All Groups” and “My Groups” which are both populated with AJAX calls. I have a site that is 100% private with only hidden groups. I want users to only see a list of their groups, hence the “My Groups” tab. However, lots of navigation and what have you defaults to the “All Groups.” I would like to either remove the “My Groups” and let it default to all, or remove the “All Groups” and let it default to “My Groups.” Leaving the “All Groups” is an option since all of my groups are hidden anyway.

  19. Profile photo of dmichelle

    I tried and none of this worked for me. I’m not a developer. Looks like this information could be out of date?

  20. how can i merge two profile group fields to one tab in edit profile tab in buddypress (i have a two profile group one is base and second is custom when i goes to my edit profile page it shows me two button one is base and second is custom i do not want it separately i want to merge their fields in single tab is it possible?)

  21. Profile photo of svenl77

    Hi @All,

    I see its time to write a update on this topic, I will update the article to support the newest version soon. Just added it to my todo list for the next days.

    Thanks for all the feedback ;-)

  22. Shaun Ramkelawon says:

    Hi, thanks for the excellent information, I was wondering if anybody knew how to remove the member count on the ‘Members’ Tab. Currently it shows something like this ‘Members (3)’ – or just ‘Members 3’. I want to remove the number count completely so that it just says ‘Members’. Please can someone help, been searching all over the place to no avail.

    Many thanks
    Shaun

    • Profile photo of themekraft

      …simply via theme options in the Custom Community Theme:

      Profiles:
      go to Theme Settings > Profile > Profile Menu Order

      Groups:
      go to Theme Settings > Groups > Groups Menu Order

      ;)

  23. Profile photo of niangari

    Hi everybody! Ok, after 10 hours of research and trying, I surrender and ask to people who know more than me.

    I’m trying to change the default tab “home” of each buddypress groups for the “forum”, so I can Hide or delete the “home” tab and only use the forum.

    I’ve tried hundreds of different codes I’ve found on diferent blogs but no one does ANYTHING in the way the tabs are shown or oppened in the groups.

    The last one I tried is this one (the simpliest one) http://screencast.com/t/tJE8UFQy7

    There is also the root in which I created the bp-custom.php file.

    I can’t think anything. Please could anybody help me with this?

    Thank you all!

  24. Profile photo of svenl77

    Hi @niangari,

    thank you for your comment and sorry for the late reply.

    At this time you need php knowledge.

    you need to create a static front.php. Maybe this article helps you.
    http://bp-tricks.com/featured/creating-a-custom-front-page-for-your-buddypress-groups/

    We have created a feature request and will add 2 new options for the groups and profil manipulation in the next version.

  25. Hi svenl77,

    Thank you for this useful article. I want to rename “Change Avatar” tab in profile to “Change Photo”, do you know how I can do this?

    Thanks in advance
    Hope

  26. Hello ! Thanks for this great article and discussion. Any idea to make work the code to set the forum nav item as the default nav item in groups in the latest version of buddypress ? I said that I have a french version, is there perhaps a problem ? Thanks for helping me !

    • Profile photo of konrads

      hi Jeff,

      you can change order but not which tab is the actual starting tab when you open a profile for example..

      I made a new ticket on github for adding these features for one of the next updates, see link to github here:
      https://github.com/Themekraft/Custom-Community/issues/79

      konrad

  27. Hi There,

    Thanks for the great explanation. I need to change the sub menu item ‘friends’ within ‘activity’ to the first position and make it active. Any idea how to solve this?

    Many thanks in advance.

    Tee

    • This still works. Make sure you edit the above because the php isn’t displaying properly. For example:

      `/*
      * Change order of user profile tabs
      */
      function bbg_change_profile_tab_order() {
      global $bp;

      $bp->bp_nav[‘profile’][‘position’] = 10;
      $bp->bp_nav[‘activity’][‘position’] = 20;
      $bp->bp_nav[‘achievements’][‘position’] = 30;
      $bp->bp_nav[‘friends’][‘position’] = 40;
      $bp->bp_nav[‘messages’][‘position’] = 50;
      $bp->bp_nav[‘forums’][‘position’] = 60;
      $bp->bp_nav[‘settings’][‘position’] = 70;
      }
      add_action( ‘bp_setup_nav’, ‘bbg_change_profile_tab_order’, 999 );`

  28. anyone know how to have it go back one directory. See my question here http://wordpress.stackexchange.com/questions/137991/buddypress-slug-issues

  29. Before sometime I was struggling to get my work done.

    Thanks to your tutorial. I just not solve my problems but also gives me an understanding of how BuddyPress works.

  30. Meagan O'Brien says:

    This didn’t work anymore for me. Probably too many BP/WP updates. On BP 2.0.1 right now. Here is solution to paste into your bp-custom.php:

    function bbg_change_profile_tab_order() {
    global $bp;

    $bp->bp_nav[‘profile’][‘position’] = 10;
    $bp->bp_nav[‘activity’][‘position’] = 20;
    $bp->bp_nav[‘groups’][‘position’] = 30;
    $bp->bp_nav[‘settings’][‘position’] = 40;
    }
    add_action(‘bp_setup_nav’, ‘bbg_change_profile_tab_order’, 999 );

    found on the comments section of this post: http://bp-tricks.com/snippets/code/arrange-group-profile-navigation-menu/
    thx.

  31. I am attempting to rename group menu items

    I have this but no luck :( any help would be appreciated.
    This is in my bp-custom.php file

    function bbg_change_profile_name() {
    global $bp;
    $bp->bp_options_nav[‘groups’][‘forum’][‘name’] = ‘school topics’;
    $bp->bp_options_nav[‘groups’][‘home’][‘name’] = ‘school activity’;
    $bp->bp_options_nav[‘groups’][‘members’][‘name’] = ‘classmates’;

    }

    add_action( ‘bp_setup_nav’, ‘bbg_change_profile_name’ );

  32. Profile photo of giovannipepperoni
    giovannipepperoni says:

    this is wonderfully helpful so can you advise on how to create a tab in the profile for creating Groups ? i know there is a button on the Groups page, but can’t seem to figure out now to get that ability within a profile.
    thanks.

  33. Hi there, great page, I was wondering if you knew the code to do the following:
    I’m adding to the buddypress.css:

    #buddypress div.item-list-tabs#object-nav ul li {
    display: none;
    }

    to hide the top nav. But I don’t want this to hide object-nav in singe groups, only the profile pages,. How could I amend that css? Do you have any info that may help? I’d be so grateful, it has sucked sooo much of my time away :-/
    Thanks you :-)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>