Make WordPress Core

Changeset 40956


Ignore:
Timestamp:
06/27/2017 12:26:07 AM (7 years ago)
Author:
SergeyBiryukov
Message:

Administration: In user list tables, display a dash instead of a blank space and add "Unknown" as a screen reader text when the user's first name and last name are blank.

Props Girishpanchal, yahil.
Fixes #40628.

Location:
trunk/src/wp-admin/includes
Files:
2 edited

Legend:

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

    r40310 r40956  
    259259     */
    260260    public function column_name( $user ) {
    261         echo "$user->first_name $user->last_name";
     261        if ( $user->first_name && $user->last_name ) {
     262            echo "$user->first_name $user->last_name";
     263        } else {
     264            echo '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . _x( 'Unknown', 'name' ) . '</span>';
     265        }
    262266    }
    263267
  • trunk/src/wp-admin/includes/class-wp-users-list-table.php

    r40823 r40956  
    472472                        break;
    473473                    case 'name':
    474                         $r .= "$user_object->first_name $user_object->last_name";
     474                        if ( $user_object->first_name && $user_object->last_name ) {
     475                            $r .= "$user_object->first_name $user_object->last_name";
     476                        } else {
     477                            $r .= '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . _x( 'Unknown', 'name' ) . '</span>';
     478                        }
    475479                        break;
    476480                    case 'email':
Note: See TracChangeset for help on using the changeset viewer.