Fix showing selected for none. Props johnbillion. fixes #13468

git-svn-id: https://develop.svn.wordpress.org/trunk@14779 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2010-05-21 14:35:39 +00:00
parent 3bb7cdf6c3
commit ffed6e8554

View File

@ -621,12 +621,14 @@ function wp_dropdown_users( $args = '' ) {
if ( $show_option_all )
$output .= "\t<option value='0'>$show_option_all</option>\n";
if ( $show_option_none )
$output .= "\t<option value='-1'>$show_option_none</option>\n";
if ( $show_option_none ) {
$_selected = selected( -1, $selected, false );
$output .= "\t<option value='-1'$_selected>$show_option_none</option>\n";
}
foreach ( (array) $users as $user ) {
$user->ID = (int) $user->ID;
$_selected = $user->ID == $selected ? " selected='selected'" : '';
$_selected = selected( $user->ID, $selected, false );
$display = !empty($user->$show) ? $user->$show : '('. $user->user_login . ')';
$output .= "\t<option value='$user->ID'$_selected>" . esc_html($display) . "</option>\n";
}