BuddyPress slug prefix

By : Cameron
Source: Stackoverflow.com
Question!

At the official BuddyPress website http://buddypress.org/ They are running a single WordPress installation with BP. However for some of the pages they have prefixed them with /community/ for example: http://buddypress.org/community/members/ not all slugs have been prefixed for example http://buddypress.org/register/

Any ideas on how this has been done and can be recreated as a client is requesting a similar feature for a project. Thanks

By : Cameron


Answers

A simple way:

1. Update your permalink structure

/%postname%

EDIT: permalink structure applies to posts not pages.

2. Create a page with a slug community, create a sub-page with a slug members.

EDIT2:

Huh, I thought BP was a some sort of social network built on top of WP, but OK, I see my mistakes now :] So I downloaded the thing and had some moments with it. It seems that those url structures that you were talking about (community/members) are working out of the box. Specifically, bp-core/bp-core-catch-uri.php is where most of the fun is happening. The URI is analyzed and broken into pieces and goes through all sorts of filtering. The main point is that first part of URI that goes after domain is skipped if it doesn't mean anything (there is no such component probably), so you could create URIs like

mysite.com/blah-blah-blah/activity/groups 

and it would have the same effect as

mysite.com/activity/groups

I've tested it and it seems to work. Although I strongly recommend to dig into the source code and understand all of the URI filtering details before doing anything serious. Hope it helps.

By : Tumas


This video can help you solving your question :)
By: admin