Customizing Buddypress URLs For Profile, Members And Messages

In this post, I will show you a way of customizing buddypress URLs for Profile, Members, Friends and Messages.

AS we all know, BuddyPress is an easy way to create social media-like feature on your WordPress website or Blogs.

This post will not be covering the installation and configuration of the BuddyPress plugin. I am assuming you already have your BuddyPress site all setup.

It is easy to create menu for Activity, Members and Groups on the site because these are already attached to specific page. So all you have to do is pull the pages into your menu.

Creating menu for Profile, Friends, Messages, Settings etc, isn’t as straight forward as the ones mentioned above. This is because the url comes out in this form http://yourdomain/members/yourusername. This makes it difficult to add it as a custom link menu. This is because every user has a unique username. A url that works for one user will either bring a 404 page error or link you to the profile of the user whose username is in the link. Using http://yourdomain/members/%USERNAME%/ used to solve this problem but it stopped worked a long time ago (or you could create a html link with <a href=””>Profile</a>).

BuddyPress team are working hard at making their product more user friendly and customizable so I’m hoping in the future this option will be available in their settings option.

Customizing Buddypress URLs Profile Members Messages

Current BuddyPress URLs:

  1. http://yourdomain/members/yourusername
  2. http://yourdomain/members/yourusername/friends
  3. http://yourdomain/members/yourusername/messages
  4. http://yourdomain/members/yourusername/settings

Customized PuddyPress URLs:

  1. http://yourdomain/yourusername
  2. http://yourdomain/friends
  3. http://yourdomain/messages
  4. http://yourdomain/settings

The new customized links will work for every user, regardless of their usernames

First of all (like I said earlier) you should have finished setting up you BuddyPress site. Secondly, make sure you know what you’re doing. My advice will be to back up your site before you start any of these modifications. Thirdly, you should be very familiar with the structure of WordPress installation and you Theme.

Go to you Theme Function page. It might be functions.php. You can use any editor, either the one under Appearance on your WordPress Dashboard or one of the editors on your CPanel.

DO NOT ALTER any code on the function.php, everything you see there isimportant. Just go to the bottom of the page and add this code

add_filter( 'bp_core_enable_root_profiles', '__return_true' );

The above code will remove MEMBER from your url. These work for just the profile url.

Using Widgets is also a way of adding links and menu to your site. Since it’s easy to create links using php, I’ll show you how to make Widgets recognize the codes.

At the end of you functions.php page add these codes

function execute_php($html){
     if(strpos($html,"<"."?php")!==false){ ob_start(); eval("?".">".$html);
     return $html;

This should prepare your Widget for the next list of codes. Add these codes to a Text Widget:


Profile link 

<a href="<?php echo bp_loggedin_user_domain(); ?>">Profile</a>

or use the code below for a more dynamic link

<?php echo bp_core_get_userlink( bp_loggedin_user_id() ); ?>

Friends Link

<a href="<?php global $current_user; echo home_url() . '/members/' . $current_user->user_login . '/friends/'; ?>">Friends</a>

Messages Link

<a href="<?php global $current_user; echo home_url() . '/members/' . $current_user->user_login . '/messages/'; ?>">Messages</a>
 Depending  on the structure of you theme, you can use Widget as containers for your menu.

You can use the above code template to create menu for Friends, Notifications, Settings, etc.

For more BuddyPress support go to the BuddyPress Forum

Let us know if this was helpful

No comments

Leave a Reply

Follow us

Best Reviews

  • No Posts