Customize profiles and group menus in BuddyPress

by Sven Lehnert | Feb 16, 2011 | 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

2 Comments

  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.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

More from the Magazine

Choosing The Best Web Design Tools: Top 8 Tools For Freelancers

There are a lot of people that find freelance web design to be a desired career, whether it’s because it requires a lot of self-management, or because it requires long hours. Of course, it’s also possible that this is the most satisfying profession there...

Setup a Loyalty Reward System for Your Ecommerce Store in Six Simple and Easy Steps

As an eCommerce store owner or manager, I’m pretty sure by now you are aware of the competition you are facing. In addition, to tackle your competition, you need to come up with innovative strategies every now and then. One such strategy that has helped many...

Essential Tech Skills You Need to Get Hired as a Web Developer.

According to Statista, these are the most popular web frameworks among developers worldwide in 2021. React.js (40.14 percent of use by web developers), jQuery (34.43 percent), Express (23.82 percent), Angular (22.96 percent), Vue.js (18.97), ASP.NET Core (18.1...

The 9 best Golang Web Frameworks for Web Development

When it comes to web development, GoLang’s popularity as the preferred development language has only grown since its inception in 2009. With hundreds of frameworks available, it can be difficult to find the right one that fits your needs and processes the way you work...

How to Customize Your WooCommerce Product Page in 2022

If you’re in the e-commerce business and using WooCommerce to build your store, a good product page is essential in getting your customers to talk about your brand. Furthermore, customizing your product page will have your revenue soaring! Why Exactly is a...

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

The open-source content management system WordPress currently powers 43% of all websites on the internet. That makes WordPress platform by far the most popular CMS globally, so it’s pretty clearly doing something right. If you’re looking for ways to make your digital...

3 Easiest Ways to Make Your WooCommerce Site Mobile-Friendly

3 Easiest Ways to Make Your WooCommerce Site Mobile-Friendly     If you own a WooCommerce site in 2022 and that site is not mobile-friendly, it is bad news. This is a blatant truth.   The competition in the industry is too high in today’s date and when...

3 Tips for Working With Digital Photos

So you’ve taken a bunch of great digital photos during a vacation, event, or outing, but they don’t look as good on the screen as they looked in your head. How do Instagrammers make their photos look great? Are they just stellar photographers? Not...

E-commerce Website Design: Top 10 Ecommerce Design Trends You Need To Know In 2022

Shopping has changed immensely because of the pandemic. People opt to shop online, and when your website is not ready for your customers, your business will fail.  Web design is your first line of offense; that’s why e-commerce stores these days need to focus on...

Top Pros And Cons of Native Vs Hybrid App Development in 2022

Native apps are apps intended to run on a specific OS, while Hybrid apps show elements of both a native app and a web app. The fundamental difference between these two apps is that the primary kind can be created across all stages, though the production of the native...

Benefits of Virtual Reality in WordPress Design and Development

Since the introduction of groundbreaking technologies such as Virtual Reality and AR, the world of web design has undergone a dramatic change. Major automotive brands, gaming brands, healthcare and education programmes have been the early adopters of these...

Why Digital Marketing Will Be An Important Asset For Any Startup Company In 2022

With new start-ups and brands launching each day, start-ups and new brands consequently have to compete with companies and their marketing campaigns that have been running for years. For start-ups to taste success, for instance, they have to market efficiently and...

10 Tips to Optimize Your WooCommerce Website

When we talk about e-commerce platforms, WooCommerce is considered a preferred choice for techies. It is very simple and easy to set up a WooCommerce site. You just need to simply purchase a domain, add the WooCommerce extension then utilize some tips to optimize your...

10 of the Most Important E-Commerce Trends You Need to Know in 2022: A Helpful Guide

The year 2021 brought many developments and challenges for retailers. The industry experienced advancements in technology, while simultaneously being hit with shipping and supply chain issues. The COVID-19 lockdowns forced retailers to become more innovative to reach...

15 Best Donation Plugins For Accepting Charity & Funds

Are you looking for suitable WordPress or WooCommerce-enabled donation plugins? Many plugins in the online marketplace enable you to accept online donations using your WordPress or WooCommerce-enabled site. Using donation plugins on your website is an effective and...

Top 5 Reasons to Choose Custom WordPress Development Over Theme

If you are considering having a website for your business, several questions might come to your mind. How do we develop it? Do we need to outsource website development services? How much does it cost? What platform to choose for the development? Though all of the...

Image SEO best practices for WordPress websites

Google search is one of the main traffic drivers for many websites. However, image search is gaining traction and is more relevant across different industries like photography, videography, e-commerce, entertainment, etc. In this article we’ll talk about Google image...

Is WordPress a good blogging platform?

WordPress has become one of the most important platforms for people all around the world. Being used by approximately one-third of the world’s population, it tops the most loved platforms for blogging with thousands of people adopting it as their first choice...

How is on-demand mobile app development changing the face of business?

Smartphones are the most potent and pervasive technological devices around us. Consumers connected businesses through their smartphones, where mobile apps allow them to get almost anything at the flick of a finger. Mobile apps, are also a way for businesses to connect...

The Ultimate Guide on Web Application Architecture

Learn the basics of web app architecture. In this post, you can find web application architecture types, components, and ways to create web app architecture.  Starting a new web project, you should pick the right architecture. It determines all the logic of app...

Digital Marketing: Use These Hacks to Boost Your Leads in 2021

Image (Source) Introduction  One thing the 2020 year has taught us is that it is never too late to grab new opportunities to sustain your business. COVID-19 pandemic has given an immense rise to online platform usage. It helps the businesses to continue their leads...

Deprecated Plugins on Themekraft

(Source) In a normal company’s lifespan, a lot of work is done, customers are acquired, and problems are surpassed. Also, many products are launched, and because of that many times, some of those products get left behind by time, technological advances, replaced...

Web Development Strategies for an Outstanding Site

Did you know that 59.5% of the entire world population uses the internet daily? Of this, about 92.6% use mobile devices to access the web. These people are using the internet to find products and services, connect with friends, work, and for entertainment. For any...

Lifetime Deals

Lifetime Deals or LTD is one of the most popular of many ways to sell your digital products in the SaaS industry. Subscriptions, standalone for free, and charge for some functionalities, Bundles, Addons, etc  While the subscriptions and the add ons have been around...

Our Products

Share This