From c0dc34d4c777ccb2ad1e7ddfa20eb7b4f184fa6e Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 27 Jun 2017 00:26:07 +0000 Subject: [PATCH] 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 --- src/wp-admin/includes/class-wp-ms-users-list-table.php | 6 +++++- src/wp-admin/includes/class-wp-users-list-table.php | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/class-wp-ms-users-list-table.php b/src/wp-admin/includes/class-wp-ms-users-list-table.php index d50038a898..d44bd1ed76 100644 --- a/src/wp-admin/includes/class-wp-ms-users-list-table.php +++ b/src/wp-admin/includes/class-wp-ms-users-list-table.php @@ -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 '' . _x( 'Unknown', 'name' ) . ''; + } } /** diff --git a/src/wp-admin/includes/class-wp-users-list-table.php b/src/wp-admin/includes/class-wp-users-list-table.php index 4ba5eef8be..435a5b28ae 100644 --- a/src/wp-admin/includes/class-wp-users-list-table.php +++ b/src/wp-admin/includes/class-wp-users-list-table.php @@ -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 .= '' . _x( 'Unknown', 'name' ) . ''; + } break; case 'email': $r .= "$email";