BuddyDev

Changing Default View for BuddyPress User Profile Based on Context

In BuddyPress, If you visit a user's profile, you will most probably land on their activity page. The page that you see after clicking on a user's profile is called default component.

By default, 'activity' is set as the default component. You can change the default component to any active component by putting the following line in your bp-custom.php.

Changing Default component:-

If you did that, and you visit a user's profile, the default component is set to be the profile view. Instead of the activity, you will see the profile details of the user.

To make it interesting, we can dynamically set the default component(or default profile view) based on current user/displayed user. For example,  we can set the default landing page to be "activity" if a user visits his/her own profile and the landing page to be profile details if the user visits other user's profile

Dynamically setting default component:-

Now that you know, you can change the default landing component dynamically, I expect you to go creative with your BuddyPress based social sites. All the best 🙂

2 Responses to Changing Default View for BuddyPress User Profile Based on Context