Skip to:
Content

BuddyPress.org

Ticket #5869: 5869.02.patch

File 5869.02.patch, 1.4 KB (added by r-a-y, 11 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
  • src/bp-members/bp-members-adminbar.php

     
    7575        global $bp, $wp_admin_bar;
    7676
    7777        // Only show if viewing a user
    78         if ( !bp_is_user() )
     78        if ( ! bp_is_user() ) {
    7979                return false;
     80        }
    8081
    81         // Don't show this menu to non site admins or if you're viewing your own profile
    82         if ( !current_user_can( 'edit_users' ) || bp_is_my_profile() )
     82        // Don't show this menu to users who cannot moderate or if you're viewing your
     83        // own profile
     84        if ( ! bp_current_user_can( 'bp_moderate' ) || bp_is_my_profile() ) {
    8385                return false;
     86        }
    8487
    8588        // Unique ID for the 'My Account' menu
    8689        $bp->user_admin_menu_id = 'user-admin';