WordPress.org

Make WordPress Core

Changeset 42256


Ignore:
Timestamp:
11/29/2017 03:40:31 AM (3 years ago)
Author:
dd32
Message:

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.

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

    r42202 r42256  
    267267        if ( $user->first_name && $user->last_name ) {
    268268            echo "$user->first_name $user->last_name";
     269        } else if ( ! empty( $user->first_name ) ) {
     270            echo "$user->first_name";
     271        } else if ( ! empty( $user->last_name ) ) {
     272            echo "$user->last_name";
    269273        } else {
    270274            echo '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . _x( 'Unknown', 'name' ) . '</span>';
  • trunk/src/wp-admin/includes/class-wp-users-list-table.php

    r41753 r42256  
    489489                        if ( $user_object->first_name && $user_object->last_name ) {
    490490                            $r .= "$user_object->first_name $user_object->last_name";
     491                        } else if ( ! empty( $user_object->first_name ) ) {
     492                            $r .= "$user_object->first_name";
     493                        } else if ( ! empty( $user_object->last_name) ) {
     494                            $r .= "$user_object->last_name";
    491495                        } else {
    492496                            $r .= '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . _x( 'Unknown', 'name' ) . '</span>';
Note: See TracChangeset for help on using the changeset viewer.