Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_filter( 'bp_docs_map_meta_caps', function( $caps, $cap, $user_id, $args ) {
- if ( 'bp_docs_create' === $cap ) {
- // Site admins
- if ( user_can( $user_id, 'bp_moderate' ) ) {
- $caps = array( 'exist' );
- // If this is a group and the user is a group mod or admin.
- } else if ( bp_is_group() && ( bp_group_is_mod() || bp_group_is_admin() ) ) {
- $caps = array( 'exist' );
- } else {
- $caps = array( 'do_not_allow' );
- }
- }
- return $caps;
- }, 20, 4 );
Add Comment
Please, Sign In to add comment