WordPress.org

Make WordPress Core

Ticket #18995: 18995.2.diff

File 18995.2.diff, 1.8 KB (added by scribu, 7 years ago)
  • wp-admin/includes/class-wp-users-list-table.php

    diff --git wp-admin/includes/class-wp-users-list-table.php wp-admin/includes/class-wp-users-list-table.php
    index 09cb215..00b1ba0 100644
    class WP_Users_List_Table extends WP_List_Table { 
    193193
    194194                $style = '';
    195195                foreach ( $this->items as $userid => $user_object ) {
    196                         $role = reset( $user_object->roles );
    197 
    198                         if ( is_multisite() && empty( $role ) )
    199                                 continue;
    200 
    201196                        $style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"';
    202                         echo "\n\t", $this->single_row( $user_object, $style, $role, isset( $post_counts ) ? $post_counts[ $userid ] : 0 );
     197                        echo "\n\t";
     198                        echo $this->single_row( $user_object, $style, isset( $post_counts ) ? $post_counts[ $userid ] : 0 );
    203199                }
    204200        }
    205201
    class WP_Users_List_Table extends WP_List_Table { 
    210206         *
    211207         * @param object $user_object
    212208         * @param string $style Optional. Attributes added to the TR element.  Must be sanitized.
    213          * @param string $role Key for the $wp_roles array.
    214209         * @param int $numposts Optional. Post count to display for this user.  Defaults to zero, as in, a new user has made zero posts.
    215210         * @return string
    216211         */
    217         function single_row( $user_object, $style = '', $role = '', $numposts = 0 ) {
     212        function single_row( $user_object, $style = '', $numposts = 0 ) {
    218213                global $wp_roles;
    219214
    220215                if ( !( is_object( $user_object ) && is_a( $user_object, 'WP_User' ) ) )
    221216                        $user_object = new WP_User( (int) $user_object );
    222217                $user_object->filter = 'display';
     218
    223219                $email = $user_object->user_email;
    224220
     221                if ( !empty( $user_object->roles ) )
     222                        $role = reset( $user_object->roles );
     223                else
     224                        $role = '';
     225
    225226                if ( $this->is_site_users )
    226227                        $url = "site-users.php?id={$this->site_id}&";
    227228                else