How to set up a single bbPress forum with BuddyPress

Out of the box, BuddyPress allows for instant integration with bbPress. It automatically themes the forum to match the rest of the website, and even tracks a user’s forum activity throughout the site. These are compelling reasons to use bbPress over other alternatives such as Simple:Press on any BuddyPress site.

Unfortunately, BuddyPress forces bbPress forums to be tied to groups. You cannot participate in a forum unless you are a member of its associated group. Almost every client of ours has found this confusing and asked for a single central forum. We have a solution.

Credits: Credits for most of the code used here go to R-a-y.

The messy way to do it

You could install bbPress as a standalone installation, but you would then have to integrate it with BuddyPress and create a special bbPress theme that matches your BuddyPress theme. It’s a messy solution that will take hours, and it will make your head explode when it’s time to upgrade your site, especially considering the radical changes that bbPress is undergoing.

How we will be doing it

Our solution is reversible at any time and provides an elegant experience for your users. This tutorial is going to explain how to use a group forum as the site’s single forum. We will be hiding all references to the group so your users are unaware of the unconventional setup.

Warning: This will effectively remove the ability to have multiple groups on your site, and the one group you do have will be reduced to just a forum. Users won’t be able to manually join/leave it. They will automatically join it behind the scenes upon signup.

Step 1: Create a group and a forum

Log in to your Dashboard with your administrator account. Make sure you have enabled both the bbPress Forums and Groups components.

Create a group and a forum
Create a group and a forum

Go back to the front end of your site, and navigate to the Groups page. Click the “Create a Group” button.

Name the group carefully. You can change the name later, but changing the URL that is auto-generated will be difficult. I recommend using something simple like “support” so the URL says /support/ in it when users are accessing forum topics from this group.

On the Group’s Settings page, make the group public and select the checkbox to “Enable discussion forum.”

Enable discussion forum
Enable discussion forum

You should now have a group and a forum. Excellent start.

Step 2: Let users auto-join your group

A user can add a new forum topic to your site by going to the Forums tab. But when he clicks the “New Topic” button he will be presented with a pesky message that he first needs to join a group. Not what we want.

Group Forums Directory
Group Forums Directory

To fix this we will add a function to your functions.php file, auto-joining users to your group. Add this function, replacing <# group ID #> on line five with the numeric ID of your group.

//Automatically add new users to a group
function automatic_group_membership( $user_id ) {

if( !$user_id ) return false;
groups_accept_invite( $user_id, <# group ID #> );
add_action( ‘bp_core_activated_user’, ‘automatic_group_membership’ );

Of course you will need to figure out the group’s number. Here’s a trick. If you have Firebug installed with Firefox, you can click on your group and then select the group’s avatar within Firebug. It will say the group’s number in the avatar’s image class. It will look something like: img class=”avatar group-2-avatar”.

This function will only work for new users. If you already have users on your site, they will not be added to the group. For this you may have to use the plugin BuddyPress Auto Group Join. Unfortunately it only works if you have multi-site enabled as it hasn’t been updated in a long time, so you will first have to enable multi-site in WordPress.

New users should now be automatically joined in your group.

Step 3: Have new topics automatically added to your group

Users should be able to add new topics now, but they will still get a pesky drop down forcing them to select which group they want to add the topic into, even though you only have the one group. To get rid of that you will need to replace some code in your theme. Via FTP, navigate to forums/index.php in your theme.

Find the lines that say:

<label><?php _e( ‘Post In Group Forum:’, ‘buddypress’ ) ?></label>
<select id=”topic_group_id” name=”topic_group_id”>
<option value=””>—-</option>
<?php while ( bp_groups() ) : bp_the_group(); ?>
<?php if ( bp_group_is_forum_enabled() && ‘public’ == bp_get_group_status() ) : ?>
<option value=”<?php bp_group_id() ?>”><?php bp_group_name() ?></option>
<?php endif; ?>
<?php endwhile; ?>
</select><!– #topic_group_id –>

Replace them with:

<input id=”topic_group_id” name=”topic_group_id” value=”5″ type=”hidden” />

Make sure to replace the value=”5” with your group’s number that we found earlier.

Step 4: Hide the group elements from your theme

Everything should be working flawlessly now. But, your forum will still look like a group, including options to add new groups, a group avatar, etc. No good. You will need to strip out some code from your group and forum template files until it is unnoticeable that there’s a group involved.

Edits to forums/index.php

The title of the forum will read as “Group Forums Directory”. This is misleading now. You will want to rename it as “Forum” or whatever you are titling your forum.

You can change this in your languages file, or you can change it right in the theme. To change it in the theme…

Find the lines:

<h3><?php _e( ‘Group Forums Directory’, ‘buddypress’ ) ?><?php if ( is_user_logged_in() ) : ?> &nbsp;<a class=”button” href=”#new-topic” id=”new-topic-button”><?php _e( ‘New Topic’, ‘buddypress’ ) ?></a><?php endif; ?></h3>

Replace them with:

<h3>Forum<?php if ( is_user_logged_in() ) : ?> &nbsp;<a class=”button” href=”#new-topic” id=”new-topic-button”><?php _e( ‘New Topic’, ‘buddypress’ ) ?></a><?php endif; ?></h3>

Edits to groups/index.php

Whenever you view a forum topic, you are actually viewing a group page. It will have a button to “Create a Group.” We will replace this with a button to “View all Forum Topics” returning users to the main forum.

Find the lines:

<h3><?php _e( ‘Groups Directory’, ‘buddypress’ ) ?><?php if ( is_user_logged_in() ) : ?> &nbsp;<a class=”button” href=”<?php echo bp_get_root_domain() . ‘/’ . BP_GROUPS_SLUG . ‘/create/’ ?>”><?php _e( ‘Create a Group’, ‘buddypress’ ) ?></a><?php endif; ?></h3>

Replace them with:

<h3><?php _e( ‘Groups Directory’, ‘buddypress’ ) ?> &nbsp;<a class=”button” href=”<?php echo bp_get_root_domain() . ‘/’ . BP_FORUMS_SLUG ?>”><?php _e( ‘View all Forum Topics’, ‘buddypress’ ) ?></a><?php if ( is_user_logged_in() && current_user_can(‘administrator’)) : ?> &nbsp;<a class=”button” href=”<?php echo bp_get_root_domain() . ‘/’ . BP_GROUPS_SLUG . ‘/create/’ ?>”><?php _e( ‘Create a Group’, ‘buddypress’ ) ?></a><?php endif; ?></h3>

Edits to groups/single/group-header.php

The group header is where most of the references to your forum being a group are. We will want to remove most of the code from this file.

Replace all code here with:

<?php do_action( ‘bp_before_group_header’ ) ?>

<?php do_action( ‘bp_after_group_header’ ) ?>

<?php do_action( ‘template_notices’ ) ?>

Edits to groups/single/forum/topic.php

Individual forum topics include a button for the “Group Forum Directory” which we will be replacing with a button to “View all Forum Topics.”

Find the lines:

<a class=”button” href=”<?php bp_forum_permalink() ?>/”>&larr; <?php _e( ‘Group Forum’, ‘buddypress’ ) ?></a> &nbsp; <a class=”button” href=”<?php bp_forum_directory_permalink() ?>/”><?php _e( ‘Group Forum Directory’, ‘buddypress’) ?></a>

Replace them with:

<a class=”button” href=”<?php bp_forum_directory_permalink() ?>/”><?php _e( ‘View all Forum Topics’, ‘buddypress’) ?></a>

Edits to _inc/css/default.css

There are some elements that make sense to hide through CSS. It’s quick and reversible. Adding the following code to your stylesheet should do the trick:

/* > Single Forum Setup
————————————————————– */

body.forum #item-header, body.forum #item-nav {
display: none;
table.forum th#th-group, table.forum td.td-group {
display: none;
body.my-groups #item-body #subnav.item-list-tabs, body.my-groups #item-body .groups {
display: none;

Step 5: Remove any ability to access groups

Remove Groups from navigation

In your header.php file, you will want to comment out the link to the Groups page so the Groups menu no longer shows up in your navigation.

<?php if ( bp_is_active( ‘groups’ ) ) : ?>
<li<?php if ( bp_is_page( BP_GROUPS_SLUG ) || bp_is_group() ) : ?> class=”selected”<?php endif; ?>>
<a href=”<?php echo site_url() ?>/<?php echo BP_GROUPS_SLUG ?>/” title=”<?php _e( ‘Groups’, ‘buddypress’ ) ?>”><?php _e( ‘Groups’, ‘buddypress’ ) ?></a>

Remove Groups from URLs

If someone knows what they are doing, they could still potentially type /groups into your URL to get to the Groups page. They could also type /groups/create to create a new group on you site. You can install a redirect plugin such as Redirection and simply redirect these pages to /forums.

Redirect URL
Redirect URL

Remove Groups from Admin Bar

Your users can still navigate to the Groups menu in the Admin Bar, which is misleading and confusing. To remove this menu item completely, just add this function to functions.php:

// remove groups from adminbar
function bb_remove_groups_from_nav() {
global $bp;

unset( $bp->bp_nav[groups] );
add_action( ‘init’, ‘bb_remove_groups_from_nav’ );

You should be all done now!

Reversing all of your changes

Down the road, bbPress will eventually be re-coded as a plugin and will potentially have the ability to integrate with BuddyPress as a standalone forum, without the need for hacking. Don’t worry, what we’ve done today is easily reversible for when that time finally comes.

Just comment back in the Groups menu in your header.php file, remove the extra functions from your functions.php file, and revert back to the default template files for groups and forums (included in bp-default). If you added some redirects, don’t forget to remove them. You should now be back to the default multi-groups and multi-forums setup, with one existing group and forum.

Want us to do it all for you?

We can set this up on your site in 2 hours at $100/hr. Click Add to Cart to get a single forum on your site.

[cart-button item=”112510001″ ]

15 Responses
  1. Awesome, just what I was looking for. The only thing is this tutorial leaves a BUNCH of group-related stuff all across buddypress. For instance the number of members in each group AKA forum, invites to the group and the number of groups a user is in on their profile page.

  2. @Jordan,

    In many ways this is a compromised solution – but it’s the best solution available. The core issue in my opinion is that BuddyPress won’t let you integrate a forum without it being tied to a group. That will *hopefully* be changed in BP 1.3 when bbPress is re-released as a plugin. The reason I like this solution is because it works well, and because it’s all reversible for when things are implemented in a better fashion in BP.

    I added all of the Groups references I spotted into this tutorial. There may be more that I missed, as you’ve pointed out. If you want to you can continue editing to remove all of that extra info from those template files. Just do your edits in a child theme so when the time comes you can easily revert to default files.

  3. Hi, after posting in the forum I get redirected to the groups forum screen with the topic instead of the “upper” forum screen. Any way to get redirected to the “upper” forum?
    Thanks! Monique

  4. Does this still work with the latest version of buddypress and bbforum? I can’t follow the steps because certain files are different? i.e. no forum/index.php ?

    Any advice is greatly appreciated!

  5. It may not still work. This is quite old.

    I suggest using the beta of bbPress for this purpose. The final version will be out later this year. bbPress is being developed by one of the core BuddyPress developers (JJJ) and it will be tightly integrated with BuddyPress, usable as a standalone forum.

  6. Nice post -thanks!

    I am struggling with adding BuddyPress to my WP theme (see my site link) & bbpress plugin.

    This seems to confirm to me that BP&WP integration is not as easy as BP seem to indicate (certainly I am struggling with it!).

    I have spent ages already trying to understand BuddyPress & integrate it with WordPress but I will keep trying to get it working & understand this more!

    1. Richard,
      BuddyPress themes are completely different than Wordpress themes. They are not interchangeable. Hope this helps.

  7. Yes, I know WordPress and BuddyPress themes are different but I also know it is possible to convert WordPress themes into BuddyPress ones (can be done with BuddyPress template pack plugin and following BP guidelines to remove padding & align elements etc from theme and adding buddypress tag to theme css style header). I have done this with my WP theme & all is good (except it took a while to do!) and I continue to gain more experience with WP & BP. Thanks again & best wishes

  8. When referring to the ‘functions.php’ file to edit, is this from the theme or a plugin?
    Possibly a stupid questions but I seem to be none the wiser.

  9. hi, I wonder if you could help me with this issue:

    After 10 hours of research and trying, I surrender and ask to people who know more than me.

    I’m trying to change the default tab “home” of each buddypress groups for the “forum”, so I can Hide or delete the “home” tab and only use the forum.

    I’ve tried hundreds of different codes I’ve found on diferent blogs and with some changes I made but no one does ANYTHING in the way the tabs are shown or oppened in the groups.

    The last one I tried is this one (the simpliest one) http://screencast.com/t/tJE8UFQy7

    There is also the root in which I created the bp-custom.php file.

    I can’t think anything to fix this. Please could anybody help me with this? Does anybody thing about anything that is causing this?

    Thank you all!

Leave a Comment

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