How to Change the Default Members Landing Tab in BuddyPress

For the past two weeks, I’ve been helping a friend build his site. The site uses WordPress and BuddyPress and is the first opportunity I’ve had to use BuddyPress for a project. The site is dedicated to a Hockey League league that’s specific to a video game. The league has a number of players and teams.

By default, when a visitor browses a BuddyPress member’s profile, the activity tab is displayed. Since a player’s team is displayed on a user’s profile, I wanted the profile tab to be the first thing users see. According to the BuddyPress Codex, it’s possible to change the default landing tab by adding a line of code to either a bp-custom.php file or to wp-config.php. The code is as follows:

* Change BuddyPress default Members landing tab.
define('BP_DEFAULT_COMPONENT', 'profile' );

As I didn’t want to create and upload another php file, I inserted the code into wp-config.php. At the time of writing this article, the help document on the BuddyPress Codex did not specify where in the wp-config file the code should be placed. After adding the code to the bottom of the wp-config file, I noticed it didn’t work.

The trick is to add it to a place that runs before BuddyPress is fully loaded. I moved the code so that is was after the define(‘DB_COLLATE’, ”); line in wp-config. This allowed the code to run without any issues.

Code Added to the Proper Place in the wpconfig File
Code Added to the Proper Place in the wp-config File

With the code in place, whenever someone clicks on a player’s name that’s mentioned in a post, the first thing they see is their profile and the team they’re assigned too.

Profile Page Loads First in BuddyPress
Profile Page Loads First in BuddyPress

This is a small change in how BuddyPress works but for an implementor like me, it was a bit of a hassle. The largest obstacle in achieving what I wanted were the directions that don’t specify where in the config file the code should be placed. I’ve since edited the Codex article to prevent others from experiencing the same trouble.


4 responses to “How to Change the Default Members Landing Tab in BuddyPress”

  1. This isn’t unique to BuddyPress – all additions to the wp-config file must go before the line `require_once(ABSPATH . ‘wp-settings.php’);` as it is this line that loads WordPress.

    Without wishing to be insulting, it’s something that any WP coder should know, so it’s understandable that it didn’t get specifically mentioned on that BP Codex page.

  2. Can you tell me if you used some type of profile plugin to list your menu vertically under the user photo?


Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

%d bloggers like this: