Make WordPress Core


Ignore:
Timestamp:
07/25/2017 05:42:14 PM (9 years ago)
Author:
johnbillion
Message:

Users: Show a Super Admin label next to Super Admins on all user listing screens when the current user can manage network users.

Fixes #41165

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-users-list-table.php

    r41138 r41150  
    406406                $actions = array();
    407407                $checkbox = '';
     408                $super_admin = '';
     409
     410                if ( is_multisite() && current_user_can( 'manage_network_users' ) ) {
     411                        if ( in_array( $user_object->user_login, get_super_admins(), true ) ) {
     412                                $super_admin = ' — ' . __( 'Super Admin' );
     413                        }
     414                }
     415
    408416                // Check if the user for this row is editable
    409417                if ( current_user_can( 'list_users' ) ) {
     
    412420
    413421                        if ( current_user_can( 'edit_user',  $user_object->ID ) ) {
    414                                 $edit = "<strong><a href=\"$edit_link\">$user_object->user_login</a></strong><br />";
     422                                $edit = "<strong><a href=\"{$edit_link}\">{$user_object->user_login}</a>{$super_admin}</strong><br />";
    415423                                $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
    416424                        } else {
    417                                 $edit = "<strong>$user_object->user_login</strong><br />";
     425                                $edit = "<strong>{$user_object->user_login}{$super_admin}</strong><br />";
    418426                        }
    419427
     
    454462
    455463                } else {
    456                         $edit = '<strong>' . $user_object->user_login . '</strong>';
     464                        $edit = "<strong>{$user_object->user_login}{$super_admin}</strong>";
    457465                }
    458466                $avatar = get_avatar( $user_object->ID, 32 );
Note: See TracChangeset for help on using the changeset viewer.