Sure. My answer here probably addresses your question: https://www.ads-software.com/support/topic/bp-docs-for-groups-only/
In general, we use WP capabilities to see whether a user can do something. You can add filters like this example:
add_filter( 'map_meta_cap', 'change_who_may_create_docs', 99, 4 );
function change_who_may_create_docs( $caps, $cap, $user_id, $args ) {
if ( 'bp_docs_create' === $cap && {some_logic_for_who_should_be_able_to_create_docs} ) {
$caps = array( 'exist' );
} else {
$caps = array( 'do_not_allow' );
}
return $caps;
}
In your example, if you were using vanilla BP Docs, limiting to Group Mods and Admins doesn’t make a lot of sense, since much of Docs happens outside of groups, though you could make up some logic like:
$is_admin_of_any_group = bp_get_user_groups( $user_id, array(
'is_admin' => true,
) );
$is_mod_of_any_group = bp_get_user_groups( $user_id, array(
'is_mod' => true,
) );
to do a broad check.
-
This reply was modified 5 years, 8 months ago by David Cavins.