This is a short article about how to customize profiles and groups in BuddyPress.
It took me a while to find all the answers, that’s why I bring them all together here, so you do not need to search again.
Starting with the customize profiles
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
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
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
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.
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!)
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
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:
Hi … very interesting post. I wonder if there is a way to add new items to a buddypress menu. Thanks