Show user_login in Dashboard user dropdowns.

User dropdowns in wp-admin have traditionally shown the users' display names.
However, this causes ambiguity when users share display names. To correct this,
we now show the unique user_login in parentheses after the display name.

The new `display_name_with_login` value for the `show` parameter of
`wp_dropdown_users()` enables this functionality. The default value of `show`
has not been changed, for backward compatibility, but all instances of
`wp_dropdown_users()` in core wp-admin have been switched.

This changeset also reduces some duplicated logic when assembling a user list
when `include_selected` is true.

Props krogsgard, boonebgorges.
Fixes #31251.

git-svn-id: https://develop.svn.wordpress.org/trunk@35790 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2015-12-06 20:56:11 +00:00
parent c3b6753782
commit ded2547b57
7 changed files with 178 additions and 25 deletions

View File

@@ -1335,7 +1335,8 @@ class WP_Posts_List_Table extends WP_List_Table {
'name' => 'post_author',
'class'=> 'authors',
'multi' => 1,
'echo' => 0
'echo' => 0,
'show' => 'display_name_with_login',
);
if ( $bulk )
$users_opt['show_option_none'] = __( '— No Change —' );