Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Roles and Capabilities in bbPress 2.2

@aberglas

Participant

You say “Capabilities are saved in the database, per user, per site”. That is clearly NOT the (normal) case. The wp_usermeta table wp_2_capabilities row stores ROLES, not capabilities. Those roles appear to index into the wp_2_options tble row wp_2_user_roles row which contains a list of capabilities.

I have no idea what “Dynamic” roles are nor why bbpress contains a vast amount of capability fidling code, including no less than three files called capability.php. If someone could explain it in terms of actual table rows and colums that might help.

I want a simple setup where Authors can access Private forums but only in the site which they are an Author. The simple coupled set up that JJJ says is too simplistic. But now it cannot be done at all?

By default private sites are hidden to users. There is a weird “Auto Role” option that can adds bbp_participant to all users. But that means that users get access to all forums on all sites. Is that the “Dynamic role” feature?

So turn that off. Try to add bbp_participant role explicitly using action ‘add_user_to_blog’
$user->add_role(“bbp_participant”);
However, that failed to add the user. WordPress really only supports one role per user, certainly set_role() only accepts a single role and purges any others. So I think something is resetting it.

Then I try simply
get_role( ‘author’ )->add_cap( ‘read_private_topics’ ); // for bbpress.
That successfully updates the database (wp_2_user_roles), but has no effect on bbpress. I suspect because one of the capability.php files in bbpress has
case bbp_get_spectator_role() … ‘read_hidden_forums’ => false,
rather than just leaving it out. So capabilities do not merge properly between roles.

I am new to WordPress/bbPress, and having spent many hours in this mess am getting very frustrated. How hard can it be? Users/Roles/Capabilities.

Anthony

Skip to toolbar