Reply To: limited capabilities for roles in a specific forum
Thanks, that is very helpful, but it change roles globally. I need it for a specific forum.
- is possible call these actions to an existing role?
- and is possible call them only for a specific forum
I tried this but seems not work…. :/
// BBPRESS ROLES CONFIG FOR SPECIFIC FORUM
if ( bbp_forum_title(); == "My Forum Title" ) {
function add_role_caps_filter( $caps, $role )
{
/* Only filter for roles we are interested in! */
if( $role == 'participant' )
$caps = custom_capabilities( $role );
return $caps;
}
add_filter( 'bbp_get_caps_for_role', 'add_role_caps_filter', 10, 2 );
function custom_capabilities( $role )
{
switch ( $role )
{
/* Capabilities for 'tutor' role */
case 'participant':
return array(
// Primary caps
'spectate' => true,
'participate' => true,
'moderate' => false,
'throttle' => false,
'view_trash' => false,
// Forum caps
'publish_forums' => false,
'edit_forums' => false,
'edit_others_forums' => false,
'delete_forums' => false,
'delete_others_forums' => false,
'read_private_forums' => false,
'read_hidden_forums' => false,
// Topic caps
'publish_topics' => false,
'edit_topics' => false,
'edit_others_topics' => false,
'delete_topics' => false,
'delete_others_topics' => false,
'read_private_topics' => false,
// Reply caps
'publish_replies' => true,
'edit_replies' => true,
'edit_others_replies' => false,
'delete_replies' => true,
'delete_others_replies' => false,
'read_private_replies' => false,
// Topic tag caps
'manage_topic_tags' => false,
'edit_topic_tags' => false,
'delete_topic_tags' => false,
'assign_topic_tags' => false,
);
break;
default :
return $role;
}
}
}