Customize profiles and group menus in BuddyPress

by Sven Lehnert | How-to

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

1 Comment

  1. Valia

    Hi … very interesting post. I wonder if there is a way to add new items to a buddypress menu. Thanks

    Reply

Submit a Comment

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

More from the Magazine

How to Build Links for Your Website and Get High Rankings

The website content contains clickable keywords which direct the masses to the other website. Successful and reputable websites have web pages with multiple backlinks. Check the quality of backlinking using a rank checker. When it comes to backlinks, then website...

How to Optimize WooCommerce Product Pages for Better Ranking?

After launching on September 27, 2011, WooCommerce product has 5 Million plus active installations now. The number of users is increasing daily. The reasons for the huge popularity of this platform are: Price: Totally free to use. If needed you can add paid...

4 Ways To Make Your WordPress Site Mobile-Friendly

Having a mobile-friendly WordPress site will help your website be Search Engine Optimised, which is a great deal when it comes to promotion and website success. Poor SEO won’t be your only concern if your site isn’t properly built- losing customers because of the poor...

How to Optimize Content for Featured Snippets?

Over the past years, Google has been changing its policies in the way it displays results to its users. If you want to drive more traffic to your site and want users to click on your content, showing up as a featured snippet in Google search will help. Google has been...

Keep your WordPress Website Safe and Secure – Here’s How

Source Website security and safety are of utmost importance. Even though you would have taken all the necessary precautions, it is vulnerable, and security threats are significant. Google tackles these threats with a heavy hand and ends up blocking the sites...

How to Recover your Website’s SEO from a Hacked WordPress Site

WordPress, the most popular content management system is an ideal place for most of the businesses out there. However, this doesn’t mean that it is unhackable. As WordPress is so popular, hackers take their time and effort to hack WordPress websites and their SEO. If...

Top 10 Amazing Web Designing Tips To Ensure Maximum Conversion

Among various aspects of web development, web designing is undoubtedly the most crucial part. A well-researched fascinating design can lead a project to stunning success while a lack of considerations can prove a nightmare for the investing firm. Whether you are an...

Meet BuddyForms BuddyPress Post in Groups

Among the add-ons that you definitely need to have available on your website, you need to know BuddyForms BuddyPress Post in Groups, its functionalities and benefits will allow you to better develop your online business. It's great for creating BuddyPress groups for...

Must have Features for WordPress WebSite

WordPress is the most popular and preferred platform to launch business websites. According to the WordPress official site,  “WordPress website now account for over 1/3rd of the top 10 million sites. Our market share has been growing steadily over the last few...

How to Make Sure Your WordPress Site is Mobile-Friendly?

With the evolution of technology, the digital marketing plan also has evolved.  For some years, an immeasurable growth of mobile phone usage is being seen. Mobile phones are in use for many reasons. And the most prevalent and common is visiting the website for...
Share This