Multisite: Replace `is_super_admin()` with `manage_network_users` when checking for users autocomplete capabilities.

Props ashokkumar24.
Fixes #39201. See #37616.


git-svn-id: https://develop.svn.wordpress.org/trunk@39934 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Felix Arntz 2017-01-20 17:42:21 +00:00
parent d0bdcb93f0
commit 043cf0fc00
2 changed files with 2 additions and 2 deletions

View File

@ -246,7 +246,7 @@ function wp_ajax_autocomplete_user() {
wp_die( -1 ); wp_die( -1 );
/** This filter is documented in wp-admin/user-new.php */ /** This filter is documented in wp-admin/user-new.php */
if ( ! is_super_admin() && ! apply_filters( 'autocomplete_users_for_site_admins', false ) ) if ( ! current_user_can( 'manage_network_users' ) && ! apply_filters( 'autocomplete_users_for_site_admins', false ) )
wp_die( -1 ); wp_die( -1 );
$return = array(); $return = array();

View File

@ -225,7 +225,7 @@ wp_enqueue_script( 'user-profile' );
* @param bool $enable Whether to enable auto-complete for non-super admins. Default false. * @param bool $enable Whether to enable auto-complete for non-super admins. Default false.
*/ */
if ( is_multisite() && current_user_can( 'promote_users' ) && ! wp_is_large_network( 'users' ) if ( is_multisite() && current_user_can( 'promote_users' ) && ! wp_is_large_network( 'users' )
&& ( is_super_admin() || apply_filters( 'autocomplete_users_for_site_admins', false ) ) && ( current_user_can( 'manage_network_users' ) || apply_filters( 'autocomplete_users_for_site_admins', false ) )
) { ) {
wp_enqueue_script( 'user-suggest' ); wp_enqueue_script( 'user-suggest' );
} }