How to disallow participant from publishing topics(bbpress)?
OK, I am really stuck on this. I tried many things and yet nothing works.
I have BBpress install and running and want to disallow users(Participant Role) from publishing TOPICS. Every time when user add the topic, it must have to display under pending status but they can publish replies without any moderation.
I tried BBpress Moderation
plugin but its adding replies in pending status. Even after unchecking the box which says Always moderate replies
.
I Tried to change the role of Participant users to Tutor:
//code to add tutor role
function add_new_roles( $bbp_roles )
{
/* Add a role called tutor */
$bbp_roles['bbp_tutor'] = array(
'name' = 'Tutor',
'capabilities' = custom_capabilities( 'bbp_tutor' )
);
return $bbp_roles;
}
add_filter( 'bbp_get_dynamic_roles', 'add_new_roles', 1 );
function add_role_caps_filter( $caps, $role )
{
/* Only filter for roles we are interested in! */
if( $role == 'bbp_tutor' )
$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 'bbp_tutor':
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' = true,
'read_hidden_forums' = false,
// Topic caps
'publish_topics' = true,
'edit_topics' = true,
'edit_others_topics' = false,
'delete_topics' = false,
'delete_others_topics' = false,
'read_private_topics' = true,
// Reply caps
'publish_replies' = true,
'edit_replies' = true,
'edit_others_replies' = false,
'delete_replies' = false,
'delete_others_replies' = false,
'read_private_replies' = true,
// Topic tag caps
'manage_topic_tags' = false,
'edit_topic_tags' = false,
'delete_topic_tags' = false,
'assign_topic_tags' = true,
);
break;
default :
return $role;
}
}
But It shows blank role after selecting Forum Role TUTOR in user profile page.
Is there any way to add these topics by default in Pending status and Replies in Publish? Please help me!
Thank You
Topic bbpress user-roles forum moderation Wordpress
Category Web