How-to

Customize profiles and group menus in BuddyPress

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

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

More from the Blog

View all posts

BuddyForms Form Builder

BuddyForms Form Builder

3 min read

New Version of BuddyForms comes with Visual Composer Support: Auto Generate Title and Content options and more!

Community

Create Content

Uncategorized

Community

Create Content

4 min read

How to know if your community likes your content?

BuddyPress

Community

WooCommerce

BuddyPress

Community

10 min read

10 Must-Have Plugins for a Complete BuddyPress Community

BuddyForms Form Builder

How-to

BuddyForms Form Builder

How-to

3 min read

How to Create Incredible Contact Forms for WordPress

News

News

1 min read

New Framework to speed up WordPress development

News

News

2 min read

Jigoshop – BuddyPress Integration:
Your Social Network Shop

News

News

3 min read

Premium Support now available

Uncategorized

Uncategorized

4 min read

What is Web hosting?

BuddyForms Form Builder

How-to

BuddyForms Form Builder

How-to

3 min read

How to Create User Generated Content for Your WordPress Website and Business

Uncategorized

Uncategorized

3 min read

The Importance of Good Product Documentation.

Start your next project with us

Whether it's design or development, we're the perfect partner for fast, flexible, forward-thinking projects. Reach out & let's get the conversation started.
Get Started