ok, I’ve been kicking this around for the last 3 hours!!
Capabilities are spread all over the files in bbpress, so it’s taken a while to get to something.
But I’ve learnt some good stuff along the way !!
This is close to a perfect solution, and seems workable
add_filter ('bbp_register_forum_post_type', 'rew_change') ;
function rew_change () {
$rew = array(
'labels' => bbp_get_forum_post_type_labels(),
'rewrite' => bbp_get_forum_post_type_rewrite(),
'supports' => bbp_get_forum_post_type_supports(),
'description' => __( 'bbPress Forums', 'bbpress' ),
'capabilities' => bbp_get_topic_caps(),
'capability_type' => array( 'forum', 'forums' ),
'menu_position' => 555555,
'has_archive' => bbp_get_root_slug(),
'exclude_from_search' => true,
'show_in_nav_menus' => true,
'public' => true,
'show_ui' => current_user_can( 'moderate' ),
'can_export' => true,
'hierarchical' => false,
'query_var' => true,
'menu_icon' => ''
) ;
return apply_filters( 'rew_change', $rew );
}
add_filter( 'bbp_get_caps_for_role', 'rew_moderator', 10, 2);
function rew_moderator ($caps, $role) {
if ($role == bbp_get_moderator_role() ) {
$caps['edit_others_forums'] = true ;
$caps['delete_forums'] = true ;
$caps['delete_others_forums'] = true ;
$caps['publish_forums'] = true ;
$caps['read_private_forums'] = true ;
$caps['read_hidden_forums'] = true ;
$caps['edit_forums'] = true ;
}
return $caps ;
}
The line
'capabilities' => bbp_get_topic_caps(),
should say
'capabilities' => bbp_get_forum_caps(),
and my 2nd filter should then make that work, but for whatever reason it doesn’t.
But as it gives the topic permissions which for a moderator are what you want for forums, it should be fine.