Skip to:
Content

BuddyPress.org

Ticket #5869: 5869.01.patch

File 5869.01.patch, 701 bytes (added by r-a-y, 6 years ago)
  • src/bp-core/bp-core-caps.php

     
    264264        if ( bp_is_user_inactive( $user_id ) )
    265265                return $caps;
    266266
    267         // Only users that can 'manage_options' on this site can 'bp_moderate'
    268         return array( 'manage_options' );
     267        // check explicitly for the 'bp_moderate' cap
     268        $user = new WP_User( $user_id );
     269        if ( ! empty( $user->allcaps['bp_moderate'] ) ) {
     270                return $caps;
     271
     272        // 'bp_moderate' cap does not exist; do not allow
     273        } else {
     274                return array( 'do_not_allow' );
     275        }
    269276}
    270277add_filter( 'map_meta_cap', '_bp_enforce_bp_moderate_cap_for_admins', 10, 4 );
    271278