Root profile url for members profile | Working with Buddypress URL part – 1

Buddypress allow you to make user profile page, members directory. In my previous post I discussed about bp_get_activity_root_slug() function. this function allow to get activity page URL, there is a similar function to get members directory url, it is bp_get_members_slug(). Usually, buddypress members directory slug is example.com/members, but you can select any page from wp-admin->buddypress->pages. lets say, you have selected a page named ‘USERS’ to show buddypress members directory. now, in you site,

Buddypress members directory will be, yoursite.com/USERS
Members personal activity page is, yoursite.com/USERS/USER_NAME/activiy
Members profile page will be, yoursite.com/USERS/USER_NAME/profile/public
which means, all members page will have a base slug which is USERS.

Now, can we have members profile/activity page without a base slug? as like, yoursite.com/USER_NAME !!
it looks short and better., see twitter stream URL, https://twitter.com/#!/Rimon_Habib
so, we are going to use make our buddypress members activity stream url just like twitter. it is quite simple, buddypress though it you may need this facility, thats why we have almost nothing to do but just enable this option by defining a constant.

the process is, make a file named bp-custom.php and place it to wp-content/plugins directory. now open that file with text editor and type
define ( ‘BP_ENABLE_ROOT_PROFILES’, true );
 
save the file.. now you have enabled root profile!! Congrats!

this can be done more easily, just open you wp-config.php file and type that line, but it is good practice to make changes for custom feature at bp-custom.php file.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>