/
/
Making Profile the default landing page in BuddyPress

If you have Activity enabled on your BuddyPress site, you will notice that Activity is the default landing page for user profiles. However for many sites it makes more sense to keep the public Profile page as the user landing page. It’s actually pretty simple to implement. We just need to reorder the tabs so Profile comes before Activity, and set Profile as the default tab.

If you don’t have one already, create a file in your plugins folder called bp-custom.php. Don’t forget, this file must open with .

Reorder the tabs so Profile comes before Activity

Just add this code to bp-custom.php:


/* Reorder profile tabs */
function bbg_change_profile_tab_order() {
global $bp;

$bp->bp_nav[‘profile’][‘position’] = 10;
$bp->bp_nav[‘activity’][‘position’] = 20;
}
add_action( ‘bp_setup_nav’, ‘bbg_change_profile_tab_order’, 999 );

You can add other nav items using this same format, and simply order them by increments of 10. Other options include:


$bp->bp_nav[‘blogs’][‘position’] = 30;
$bp->bp_nav[‘friends’][‘position’] = 40;
$bp->bp_nav[‘messages’][‘position’] = 50;
$bp->bp_nav[‘groups’][‘position’] = 60;
$bp->bp_nav[‘settings’][‘position’] = 70;

Set Profile as the default tab

Just add this code to bp-custom.php


/* define the default Profile component */
define(“BP_DEFAULT_COMPONENT”,”profile”);// Now when you click on a user name link, You will land on User’s profile not user’s activity page
Leave a Comment

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