An Introduction to bbPress Roles and Capabilities

Here at PublishPress, we're able to support almost any other WordPress plugin.

However, there is one popular plugin called bbPress that doesn't always work smoothly with our code, or other user management plugins.

bbPress has over 300,000 users and is the commonly used discussion board in WordPress.

I'm going to give you a guide on how to manage roles and capabilities in bbPress. I'll also touch on what bbPress does differently, and what it means for PublishPress users.

Technical Details on bbPress Capabilities

bbPress has a non-standard approach to WordPress capabilities, and has done since 2013.

Normally, WordPress capabilities are stored in the database.

However, bbPress defines its capabilities in the code and these often override any values you may have stored in your site's database.

The longer version is available in this post by John James Jacoby (often called JJJ). He is one of the most experienced developers in WordPress and made this choice believing it to be a better and safer approach for bbPress users.

But because of this approach, you may sometimes experience unusual behavior when using bbPress with plugins such as PublishPress Capabilities and other user role editors.

bbPress defines roles in this files /includes/core/capabilities.php. Click here to see the file on Github. Here's an example for the Moderator role:

// Moderator
case bbp_get_moderator_role() :
  $caps = array(

    // Primary caps
      'spectate' => true,
      'participate' => true,
      'moderate' => true,
      'throttle' => true,
      'view_trash' => true,
      'assign_moderators' => true,

Capabilities for All bbPress Forums, Topics and Replies

This part of the guide will show you how to control access for all your forums, topics and replies.

  • Install the PublishPress Capabilities plugin.
  • Go to “Capabilities” in your admin menu.
  • You will now be able to set permissions for Forums, Topics, and Replies.

An Overview of bbPress Capabilities

Here's an overview of all the capabilities you can give to bbPress users. You can see that these line up with the official bbPress roles documentation.

Forum Capabilities

  • Forums: Edit (edit_forums)
  • Forums: Edit others (edit_others_forums)
  • Forums: Publish (publish_forums)
  • Forums: Delete (delete_forums)
  • Forums: Delete others (delete_others_forums)
  • Forums Read Private (read_private_forums)

Topic Capabilities

  • Topics: Edit (edit_topics)
  • Topics: Edit others (edit_others_topics)
  • Topics: Publish (publish_topics)
  • Topics: Delete (delete_topics)
  • Topics: Delete others (delete_others_topics)
  • Topics; Read Private (read_private_topics)

Reply Capabilities

  • Replies: Edit (edit_replies)
  • Replies: Edit others (edit_others_replies)
  • Replies: Publish (publish_replies)
  • Replies: Delete (delete_replies)
  • Replies: Delete others (delete_others_replies)
  • Replies: Read Private (read_private_replies)

Click on the “Additional” tab, and you'll find a second group of capabilities for bbPress, including these:

  • assign_moderators
  • assign_topic_tags
  • delete_topic_tags
  • edit_topic_tags
  • keep_gate
  • manage_topic_tags
  • moderate
  • participate
  • read_hidden_forums
  • spectate
  • throttle
  • view_trash

The keep_gate capability is the most important capability on this list. You can use this to give users the ability to do anything, without granting them the “Keymaster” role directly.

What Capabilities Do bbPress Roles Have?

bbPress provides four extra user roles but these are locked and can not be edited by plugins such as PublishPress Capabilities:

  • Users in the “Spectator” role have no capabilities at all. All they can do is read topics and replies that are publicly visible.
  • Users in the “Participant” role. They can edit and publish their own Topics and Replies. However, they can't modify content written by other users and they have no ability to modify Forums.
  • The “Moderator” role can modify almost anything in bbPress except for Forums that they did not create.
  • Finally, the “Keymaster” role has full permission to modify anything in bbPress.

Capabilities for Specific Forums

It is possible to control permissions for specific bbPress forums. You can do this with the PublishPress Permissions Pro plugin. This tutorial has full details.

  • Install PublishPress Permissions Pro.
  • Go to “Forums” in the WordPress admin menu.
  • Edit a forum.
  • Click “enable custom permissions for Forums”.
  • Click “Update”:
Forum Permissions
Forum Permissions

You will now see several boxes under the forum. The boxes control different permissions for this specific forum:

  • Reading: who can view posts in this forum.
  • Topic creation: who can create posts in this forum.
  • Reply submission: who can reply to posts in this forum.
  • Editing: who can edit / moderate posts in this forum.
  • Association (as Parent): who can move this forum to a different place in the forum hierarchy.
Permissions Bbpress
Permissions Bbpress

Inside each box you will be able to set custom permissions for this forum. For example, under “Read this Forum”, you can choose which Roles, User or Groups can read topics inside this forum:

Bbpress Forum
Bbpress Forum

Some potential issues with PublishPress plugins

Because of the way that bbPress deals with capabilities, some things may not work as expected.

For example, in PublishPress Capabilities, you have the option to rename user roles. That will not work because bbPress stores the role names in its codebase.

If you want to change a role name in bbPress, you will also need to use a code solution. Add this to your site's functions.php file:

function my_custom_roles( $role, $user_id, $user_role ) {
	if( $role == 'Key Master' )
		return 'Site Owner';
	return $role;

add_filter( 'bbp_get_user_display_role', 'my_custom_roles', 10, 3 );

Leave a Reply

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