Customize profile and group menus in BuddyPress
February 16, 2011 in How To by svenl77
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:
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`
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:

Excellent article. Found everything I needed right in one place. THANKS SO MUCH!
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!
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.
Hi again Sven
I realised the answer to my own question, thanks anyway…
Very nice Sven, thank you very much for doing this! You’ve helped overcome two problems I needed to solve.
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.
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.
THANK YOU for taking the time to post this, just want I needed!
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
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?
@Mike: $bp->bp_options_nav['groups']['home']['css_id']
@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?
@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?
Hi there, nice article!
I wonder if you found a way to add a menu tab to the profile page?
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
Thanks!
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
* 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!
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
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
Awesome, thorough article. Huge help – thanks and keep it up!
This is great, thanks for the tip! However, when I remove a tab I end up with a blank tab at position 0. Any ideas?
Jackie, did you ever sort out your blank tab problem? I am having the same issue.
Yep – me too. I get:
When I remove a field..
I too was having the same problem with the blank tab at position 0. I ended up using this BuddyPress function to successfully remove nav items.
bp_core_remove_nav_item(‘groups’);
instead of $bp->bp_nav['groups'] = false;
Obviously you can replace ‘groups’ with whatever nav item you’re trying to remove.
Hope this helps!
thanks, will update the article if I find some free time
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?
Thanks….Great!
Thanks for sharing this tuts it will be helpful for my buddypress site
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?
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?
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.
Thanks in advance!
This works: $bp->bp_options_nav['activity']['all-activity']['name'] = ‘Everyone’;
Hope that helps
I can not get this to work at all.
the redirect does nothing.
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’);
?>
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’ );
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.
I tried and none of this worked for me. I’m not a developer. Looks like this information could be out of date?
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?)
how to add new tab next to change avatar in profile page ?
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 ;-)
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
Any updates on how we can do this in version 1.6 of Buddypress?
Thanks in advance.
…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
;)
[...] am going by the instructions given here to be able to do this. However when I go to activate the plugin i get a fatal [...]
Great stuff.
Saved me searching that all out myself.
BP needs a bit of tweaking top make it user freindly
Excellent!!!
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!
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.
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
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 !
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
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
I followed this and all I got was a bunch of errors on my page.
the article is quite old, not sure if this still works..