好吧,我真的被困在这个问题上了。我尝试了很多事情,但都没有成功。
我已安装并运行BBpress,希望禁止用户(参与者角色)发布主题。每次用户添加主题时,它必须显示在挂起状态下,但他们可以发布回复而无需任何调节。
我试过了BBpress Moderation
插件,但其添加回复处于挂起状态。即使在取消选中框后Always moderate replies
.
我尝试将参与者用户的角色更改为导师:
//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;
}
}
但在用户配置文件页面中选择论坛角色导师后,显示空白角色。是否有任何方法可以在默认情况下将这些主题添加到挂起状态并在发布中添加答复?请帮帮我!
非常感谢。