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.

git-svn-id: https://develop.svn.wordpress.org/trunk@40956 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2017-06-27 00:26:07 +00:00
parent 4b7514b83d
commit c0dc34d4c7
2 changed files with 10 additions and 2 deletions

View File

@ -258,7 +258,11 @@ class WP_MS_Users_List_Table extends WP_List_Table {
* @param WP_User $user The current WP_User object.
*/
public function column_name( $user ) {
echo "$user->first_name $user->last_name";
if ( $user->first_name && $user->last_name ) {
echo "$user->first_name $user->last_name";
} else {
echo '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . _x( 'Unknown', 'name' ) . '</span>';
}
}
/**

View File

@ -471,7 +471,11 @@ class WP_Users_List_Table extends WP_List_Table {
$r .= "$avatar $edit";
break;
case 'name':
$r .= "$user_object->first_name $user_object->last_name";
if ( $user_object->first_name && $user_object->last_name ) {
$r .= "$user_object->first_name $user_object->last_name";
} else {
$r .= '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . _x( 'Unknown', 'name' ) . '</span>';
}
break;
case 'email':
$r .= "<a href='" . esc_url( "mailto:$email" ) . "'>$email</a>";