WordPress.org

Make WordPress Core

Changeset 42805


Ignore:
Timestamp:
03/08/2018 07:47:17 PM (3 years ago)
Author:
SergeyBiryukov
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.
Merges [42256] and [42257] to the 4.9 branch.
Fixes #42713.

Location:
branches/4.9
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-admin/includes/class-wp-ms-users-list-table.php

    r41683 r42805  
    256256        if ( $user->first_name && $user->last_name ) {
    257257            echo "$user->first_name $user->last_name";
     258        } elseif ( $user->first_name ) {
     259            echo $user->first_name;
     260        } elseif ( $user->last_name ) {
     261            echo $user->last_name;
    258262        } else {
    259263            echo '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . _x( 'Unknown', 'name' ) . '</span>';
  • branches/4.9/src/wp-admin/includes/class-wp-users-list-table.php

    r41753 r42805  
    489489                        if ( $user_object->first_name && $user_object->last_name ) {
    490490                            $r .= "$user_object->first_name $user_object->last_name";
     491                        } elseif ( $user_object->first_name ) {
     492                            $r .= $user_object->first_name;
     493                        } elseif ( $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.