From c52f6ba99510afa345637ca1734176bd3e88250b Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Wed, 29 Nov 2017 03:40:31 +0000 Subject: [PATCH] Users: Display partial names in the user listing tables. This allows showing a name when only the first or last name is provided. Props shital-patel, antipole. Fixes #42713. git-svn-id: https://develop.svn.wordpress.org/trunk@42256 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-ms-users-list-table.php | 4 ++++ src/wp-admin/includes/class-wp-users-list-table.php | 4 ++++ 2 files changed, 8 insertions(+) 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 cefe693749..0a3adaaad1 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 @@ -266,6 +266,10 @@ class WP_MS_Users_List_Table extends WP_List_Table { public function column_name( $user ) { if ( $user->first_name && $user->last_name ) { echo "$user->first_name $user->last_name"; + } else if ( ! empty( $user->first_name ) ) { + echo "$user->first_name"; + } else if ( ! empty( $user->last_name ) ) { + echo "$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 7382f4de38..7a1359c592 100644 --- a/src/wp-admin/includes/class-wp-users-list-table.php +++ b/src/wp-admin/includes/class-wp-users-list-table.php @@ -488,6 +488,10 @@ class WP_Users_List_Table extends WP_List_Table { case 'name': if ( $user_object->first_name && $user_object->last_name ) { $r .= "$user_object->first_name $user_object->last_name"; + } else if ( ! empty( $user_object->first_name ) ) { + $r .= "$user_object->first_name"; + } else if ( ! empty( $user_object->last_name) ) { + $r .= "$user_object->last_name"; } else { $r .= '' . _x( 'Unknown', 'name' ) . ''; }