Make WordPress Core

Ticket #39204: 39204.patch

File 39204.patch, 1.5 KB (added by abhishek kaushik, 8 years ago)

Replaced is_super_admin() with current_user_can( 'manage_network' )

  • src/wp-admin/users.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    122122                        wp_die(__('Sorry, you are not allowed to edit this user.'));
    123123                // The new role of the current user must also have the promote_users cap or be a multisite super admin
    124124                if ( $id == $current_user->ID && ! $wp_roles->role_objects[ $role ]->has_cap('promote_users')
    125                         && ! ( is_multisite() && is_super_admin() ) ) {
     125                        && ! ( is_multisite() && current_user_can( 'manage_network_users' ) ) ) {
    126126                                $update = 'err_admin_role';
    127127                                continue;
    128128                }
     
    321321        $update = 'remove';
    322322        foreach ( $userids as $id ) {
    323323                $id = (int) $id;
    324                 if ( $id == $current_user->ID && !is_super_admin() ) {
     324                if ( $id == $current_user->ID && !current_user_can( 'manage_network_users' ) ) {
    325325                        $update = 'err_admin_remove';
    326326                        continue;
    327327                }
     
    377377        foreach ( $userids as $id ) {
    378378                $id = (int) $id;
    379379                $user = get_userdata( $id );
    380                 if ( $id == $current_user->ID && !is_super_admin() ) {
     380                if ( $id == $current_user->ID && !current_user_can( 'manage_network_users' ) ) {
    381381                        /* translators: 1: user id, 2: user login */
    382382                        echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>The current user will not be removed.</strong>'), $id, $user->user_login) . "</li>\n";
    383383                } elseif ( !current_user_can('remove_user', $id) ) {