Using an existing bbPress installation for your BuddyPress Forums
Archived file. Good only up to BP 1.5 version
***The following pertains to sites wanting to use an existing bbPress installation (v1.x) with BuddyPress***
*** NOTE: This is a very rare scenario! You will not need to follow this guide unless you are running a bbPress 1.x install on your site! ***
If you choose to enable group forums on BuddyPress, you will have the option to “Set up a new bbPress Installation” or to “Use an existing bbPress installation“.
What does this mean necessarily?
If you don’t have a standalone, existing version of bbPress 1.x installed somewhere, then all you have to do is click on “Set up a new bbPress installation“. Stop reading this article! You’re done!
Now, if you have an existing bbPress 1.x install, you have a choice to make.
Set Up a New bbPress installation
Pros
- Easy setup, no headaches
Cons
- Creating a new set of bbPress tables in your database solely for BuddyPress forum usage. This means you’ll have two sets of bbPress tables.
Use an existing bbPress installation
Pros
- Use your existing bbPress install, maintain one set of bbPress tables
Cons
- You will have duplicate forum posts: One on the BuddyPress side, the other on your standalone bbPress install
- By default, BuddyPress group forums and group forum posts, regardless of privacy setting, will be posted publicly on your existing bbPress installation (don’t worry though, if you still want to go ahead with this, a detailed tutorial to hide BuddyPress group forums from your existing bbPress install is listed right underneath)
Still want to go ahead with using an existing installation? Go ahead and click on “Use an existing bbPress installation” and follow the steps.
Then, implement the following to ensure your BuddyPress group forums are not publicly displayed on your existing bbPress install.
1) Change the forum slug in BuddyPress (optional)
By default, BuddyPress forums can be accessed at:
hxxp://example.com/forums/
If your existing bbPress install is also installed in /forums/, you’ll want to rename BuddyPress’ forums slug to something else.
You can do this by adding the following line in your wp-config.php:
define( 'BP_FORUMS_SLUG', 'group-forums' );
In the example above, your BP forums can now be accessed at hxxp://example.com/group-forums/
2) Create a new forum category in standalone bbPress
By default, BuddyPress will create new forums in your existing bbPress install under forum id #1 . We do not want to do this. So we’re going to create a new forum category to house these new BuddyPress forums.
- First, login to your existing bbPress admin area and click on “Forums”.
- Next, scroll down and create a new forum category. You can call this forum category “Group Forums” or whatever you want! Under “Make this forum a category”, ensure that this is checked.
- Note down the forum ID of the forum category you just created. (You can get the forum category ID by mousing over the “Edit” link and checking the “id” parameter.)
3) Tell BuddyPress to use this new forum category
In step #2, we created a new, forum category to house our BuddyPress group forums. Now we want to tell BuddyPress to use this new forum category.
This can be done by adding the following define to wp-config.php:
define ( 'BP_FORUMS_PARENT_FORUM_ID', $forum_id );
Change $forum_id to the forum ID from step #2. Now, all new BuddyPress group forums will be created in standalone bbPress under this new forum category.
3) Hide BuddyPress group forum data in standalone bbPress
Now, the last issue we have is hiding all BuddyPress group forum related data from access and view on your existing bbPress installation.
We’re going to be using _ck_’s Hidden Groups plugin to do this. Please install and activate the plugin on your existing bbPress install.
Next:
- Open up the plugin (hidden-forums.php) in a text editor.
- Comment out this line:
$hidden_forums['hidden_forums']=array(500,501,502); // hide these forums, list by comma seperated number
- Underneath that line, add the following:
$bp_hide_group_forum_category_id = $forum_id; $hidden_forums['hidden_forums']=array(); $hidden_forums['hidden_forums'][] = $bp_hide_group_forum_category_id; $forums = get_forums(); foreach ($forums as $forum) { if ($forum->forum_parent == $bp_hide_group_forum_category_id) $hidden_forums['hidden_forums'][] = $forum->forum_id; }
Change the $bp_hide_group_forum_category_id variable to the forum category ID you noted down in step #2.
—
And that should be it! By default, the admin can view every single forum post on your bbPress install, so try viewing your bbPress install when you’re logged out!
* Posted by r-a-y, July 16, 2010. This how-to was originally based on this forum post.