Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#42713 closed defect (bug) (fixed)

Users list does not display name if Last Name empty

Reported by: antipole's profile antipole Owned by: dd32's profile dd32
Milestone: 4.9.5 Priority: normal
Severity: normal Version: 4.9
Component: Users Keywords: has-patch fixed-major
Focuses: administration Cc:

Description

Hi.. I have found that in the backend list of 'All users', the user's Name is shown as a dash (—) if the user's Last name field is empty.

For users with a First Name and Last Name, the Name is shown in the list of users as the concatenated First and Last names. But if the Last Name field is empty, the list just show a dash.

I think it should accept an empty Last Name field.

As a work around, when no Last Name is available, if I add a hard space (option space) in the Last Name field, then the list shows the First Name (plus probably the space).

Attachments (5)

42713.patch (1.5 KB) - added by Shital Patel 7 years ago.
All User Name List (First Name and Last Name)
users_lists.png (9.8 KB) - added by Shital Patel 7 years ago.
42713.1.patch (1.5 KB) - added by Shital Patel 7 years ago.
42713.2.patch (1.5 KB) - added by Shital Patel 7 years ago.
All User Name List (First Name and Last Name)
42713.author-template.patch (663 bytes) - added by Hardik Amipara 7 years ago.
Patch for author-template.php

Download all attachments as: .zip

Change History (17)

@Shital Patel
7 years ago

All User Name List (First Name and Last Name)

@Shital Patel
7 years ago

All User Name List (First Name and Last Name)

#1 @Shital Patel
7 years ago

  • Focuses administration added
  • Keywords has-patch added

#2 follow-up: @dd32
7 years ago

  • Milestone changed from Awaiting Review to 5.0
  • Owner set to dd32
  • Status changed from new to accepted

Patch seems good to me.

Perhaps we should also update wp_list_authors() to also handle this for the show_fullname parameter?
Currently it also only displays if both fields are set, it looks like all other locations in core handle falling back to which ever is actually available.

#3 in reply to: ↑ 2 ; follow-up: @SergeyBiryukov
7 years ago

Replying to dd32:

Perhaps we should also update wp_list_authors() to also handle this for the show_fullname parameter?
Currently it also only displays if both fields are set

Seems intentional there, if either first_name or last_name is not set, the name is not really "full" :)

@Hardik Amipara
7 years ago

Patch for author-template.php

This ticket was mentioned in Slack in #core by hardikamipara. View the logs.


7 years ago

#5 in reply to: ↑ 3 @dd32
7 years ago

Replying to SergeyBiryukov:

Replying to dd32:

Perhaps we should also update wp_list_authors() to also handle this for the show_fullname parameter?
Currently it also only displays if both fields are set

Seems intentional there, if either first_name or last_name is not set, the name is not really "full" :)

That's fair, but everywhere else that we use the "full" name we use either of them, accounting for the fact there's not really anything "full" about having both.

But you're right, if wp_list_authors() was just showing "John" for multiple people it'd be impossible to tell them apart. That'll probably be fixed in the future by something like Select2 where multiple pieces of info can be displayed at the same time.
I guess we'll skip it from wp_list_authors() for now and just go with 42713.2.patch

#6 @dd32
7 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 42256:

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.

#7 @SergeyBiryukov
7 years ago

In 42257:

Users: After [42256], remove unnecessary double quotes around first_name and last_name properties.

See #42713.

#8 @swissspidy
7 years ago

#43092 was marked as a duplicate.

#9 @SergeyBiryukov
7 years ago

#43314 was marked as a duplicate.

#10 @SergeyBiryukov
7 years ago

  • Keywords fixed-major added
  • Milestone changed from 5.0 to 4.9.5
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for 4.9.5 consideration, and this was a regression in [40956].

#11 @SergeyBiryukov
7 years ago

#43485 was marked as a duplicate.

#12 @SergeyBiryukov
7 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 42805:

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.

Note: See TracTickets for help on using tickets.