Last active
February 3, 2020 12:23
-
-
Save dcavins/e7a3a75db2da898cf66b9d7c65363a71 to your computer and use it in GitHub Desktop.
Edit caps: Only site admins can disassociate group docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'bp_docs_map_meta_caps', function( $caps, $cap, $user_id, $args ) { | |
if ( 'bp_docs_dissociate_from_group' === $cap ) { | |
if ( user_can( $user_id, 'bp_moderate' ) ) { | |
$caps = array( 'exist' ); | |
} else { | |
$caps = array( 'do_not_allow' ); | |
} | |
} | |
return $caps; | |
}, 20, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment