mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 07:40:07 +00:00
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:
@@ -177,8 +177,13 @@ function export_date_options( $post_type = 'post' ) {
|
||||
<label><span class="label-responsive"><?php _e( 'Authors:' ); ?></span>
|
||||
<?php
|
||||
$authors = $wpdb->get_col( "SELECT DISTINCT post_author FROM {$wpdb->posts} WHERE post_type = 'post'" );
|
||||
wp_dropdown_users( array( 'include' => $authors, 'name' => 'post_author', 'multi' => true, 'show_option_all' => __('All') ) );
|
||||
?>
|
||||
wp_dropdown_users( array(
|
||||
'include' => $authors,
|
||||
'name' => 'post_author',
|
||||
'multi' => true,
|
||||
'show_option_all' => __( 'All' ),
|
||||
'show' => 'display_name_with_login',
|
||||
) ); ?>
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
@@ -214,8 +219,13 @@ function export_date_options( $post_type = 'post' ) {
|
||||
<label><span class="label-responsive"><?php _e( 'Authors:' ); ?></span>
|
||||
<?php
|
||||
$authors = $wpdb->get_col( "SELECT DISTINCT post_author FROM {$wpdb->posts} WHERE post_type = 'page'" );
|
||||
wp_dropdown_users( array( 'include' => $authors, 'name' => 'page_author', 'multi' => true, 'show_option_all' => __('All') ) );
|
||||
?>
|
||||
wp_dropdown_users( array(
|
||||
'include' => $authors,
|
||||
'name' => 'page_author',
|
||||
'multi' => true,
|
||||
'show_option_all' => __( 'All' ),
|
||||
'show' => 'display_name_with_login',
|
||||
) ); ?>
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
|
||||
@@ -289,7 +289,7 @@ function wp_ajax_autocomplete_user() {
|
||||
foreach ( $users as $user ) {
|
||||
$return[] = array(
|
||||
/* translators: 1: user_login, 2: user_email */
|
||||
'label' => sprintf( __( '%1$s (%2$s)' ), $user->user_login, $user->user_email ),
|
||||
'label' => sprintf( _x( '%1$s (%2$s)', 'user autocomplete result' ), $user->user_login, $user->user_email ),
|
||||
'value' => $user->$field,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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 —' );
|
||||
|
||||
@@ -742,7 +742,8 @@ function post_author_meta_box($post) {
|
||||
'who' => 'authors',
|
||||
'name' => 'post_author_override',
|
||||
'selected' => empty($post->ID) ? $user_ID : $post->post_author,
|
||||
'include_selected' => true
|
||||
'include_selected' => true,
|
||||
'show' => 'display_name_with_login',
|
||||
) );
|
||||
}
|
||||
|
||||
|
||||
@@ -270,7 +270,11 @@ case 'delete':
|
||||
<?php _e('Delete all content.'); ?></label></li>
|
||||
<li><input type="radio" id="delete_option1" name="delete_option" value="reassign" />
|
||||
<?php echo '<label for="delete_option1">' . __( 'Attribute all content to:' ) . '</label> ';
|
||||
wp_dropdown_users( array( 'name' => 'reassign_user', 'exclude' => array_diff( $userids, array($current_user->ID) ) ) ); ?></li>
|
||||
wp_dropdown_users( array(
|
||||
'name' => 'reassign_user',
|
||||
'exclude' => array_diff( $userids, array( $current_user->ID ) ),
|
||||
'show' => 'display_name_with_login',
|
||||
) ); ?></li>
|
||||
</ul></fieldset>
|
||||
<?php endif;
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user