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
How to Build Links for Your Website and Get High Rankings

How-to

SEO

How-to

SEO

5 min read

How to Build Links for Your Website and Get High Rankings

Marketing

Useful Tools

Marketing

Useful Tools

6 min read

8 Reasons Why WordPress Platform Remains Important for Digital Marketing in 2022

News

News

2 min read

New Version of the x2 BuddyPress Theme / Plugin and the Loop Designer Out Now

News

News

9 min read

What it means for us and others to follow the theme review guidelines.

News

Special Deals

News

Special Deals

1 min read

WordCamp Europe Special

BuddyForms Form Builder

How-to

Useful Tools

BuddyForms Form Builder

How-to

8 min read

How to speed up development

WooCommerce

WooCommerce

8 min read

10 WooCommerce Tips to Optimize Conversion Rates With the Same Traffic

Web Design

Web Design

5 min read

Best Elements for Modern Web Development in 2021

News

WooCommerce BuddyPress

News

WooCommerce BuddyPress

6 min read

Why You Should Build Your Online Shop With WordPress, BuddyPress and WooCommerce

BuddyForms Form Builder

Uncategorized

BuddyForms Form Builder

Uncategorized

5 min read

BuddyForms 2.5 Out Now

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