WordPress.org

Make WordPress Core

Changeset 20332


Ignore:
Timestamp:
03/30/2012 09:04:48 PM (9 years ago)
Author:
nacin
Message:

Clean up cap checks for autocompletes for sites and users in a network. see #19810.

Location:
trunk/wp-admin
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/ajax-actions.php

    r20319 r20332  
    151151
    152152function wp_ajax_autocomplete_user() {
    153     if ( ! is_multisite()
    154         || ! current_user_can( 'promote_users' )
    155         || wp_is_large_network( 'users' )
    156         || ( ! is_super_admin() && ! apply_filters( 'autocomplete_users_for_site_admins', false ) )
    157     ) {
    158         wp_die( -1 );
    159     }
     153    if ( ! is_multisite() || ! current_user_can( 'promote_users' ) || wp_is_large_network( 'users' ) )
     154        wp_die( -1 );
     155
     156    if ( ! is_super_admin() && ! apply_filters( 'autocomplete_users_for_site_admins', false ) )
     157        wp_die( -1 );
    160158
    161159    $return = array();
     
    216214
    217215function wp_ajax_autocomplete_site() {
    218     if ( ! is_multisite()
    219         || ! current_user_can( 'manage_sites' )
    220         || wp_is_large_network( 'sites' )
    221         || ! is_super_admin()
    222     ) {
    223         wp_die( -1 );
    224     }
     216    if ( ! is_multisite() || ! current_user_can( 'manage_sites' ) || wp_is_large_network( 'sites' ) )
     217        wp_die( -1 );
    225218
    226219    $return = array();
  • trunk/wp-admin/includes/dashboard.php

    r20279 r20332  
    417417        $actions['create-user'] = '<a href="' . network_admin_url('user-new.php') . '">' . __( 'Create a New User' ) . '</a>';
    418418
    419     if ( is_multisite()
    420         && current_user_can( 'promote_users' )
    421         && ! wp_is_large_network( 'users' )
    422         && is_super_admin()
    423         && is_network_admin()
    424     ) {
     419    if ( ! wp_is_large_network( 'users' ) )
    425420        wp_enqueue_script( 'user-search' );
    426     }
    427     if ( is_multisite()
    428         && current_user_can( 'manage_sites' )
    429         && ! wp_is_large_network( 'sites' )
    430         && is_super_admin()
    431         && is_network_admin()
    432     ) {
     421
     422    if ( ! wp_is_large_network( 'sites' ) )
    433423        wp_enqueue_script( 'site-search' );
    434     }
    435424
    436425    $c_users = get_user_count();
  • trunk/wp-admin/network/users.php

    r20279 r20332  
    246246);
    247247
    248 if ( is_multisite()
    249     && current_user_can( 'promote_users' )
    250     && ! wp_is_large_network( 'users' )
    251     && is_super_admin()
    252 ) {
     248if ( ! wp_is_large_network( 'users' ) )
    253249    wp_enqueue_script( 'user-search' );
    254 }
    255250
    256251require_once( '../admin-header.php' );
  • trunk/wp-admin/user-new.php

    r19934 r20332  
    179179wp_enqueue_script('wp-ajax-response');
    180180wp_enqueue_script('user-profile');
    181 if ( is_multisite()
    182     && current_user_can( 'promote_users' )
    183     && ! wp_is_large_network( 'users' )
     181
     182if ( is_multisite() && current_user_can( 'promote_users' ) && ! wp_is_large_network( 'users' )
    184183    && ( is_super_admin() || apply_filters( 'autocomplete_users_for_site_admins', false ) )
    185184) {
  • trunk/wp-admin/users.php

    r20279 r20332  
    340340    }
    341341
    342     if ( is_multisite()
    343         && current_user_can( 'promote_users' )
    344         && ! wp_is_large_network( 'users' )
     342    if ( is_multisite() && current_user_can( 'promote_users' ) && ! wp_is_large_network( 'users' )
    345343        && ( is_super_admin() || apply_filters( 'autocomplete_users_for_site_admins', false ) )
    346344    ) {
Note: See TracChangeset for help on using the changeset viewer.