Hi a.r.7-
BP Docs has a variety of permissions that are calculated using WordPress’s user_can() system. For instance, who can create a doc is checked via current_user_can( 'bp_docs_create' ). (You can see the logic in includes/caps.php.) The important filter you need to change the default capabilities is bp_docs_map_meta_caps. The following example restricts doc creation to users that are editors (WP Role) or higher:
add_filter( 'bp_docs_map_meta_caps', 'my_bpd_disallow_some_creators', 10, 4 );
function my_bpd_disallow_some_creators( $caps, $cap, $user_id, $args ) {
if ( 'bp_docs_create' == $cap ) {
// For example, only users with the WP editor role caps can create docs.
if ( ! current_user_can( 'delete_others_pages' ) ) {
$caps[] = 'do_not_allow';
} else {
$caps[] = 'exist';
}
}
return $caps;
}
Thread Starter
Achim
(@ar7)
Thank you, this works fine for me.