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

git-svn-id: http://svn.automattic.com/wordpress/trunk@14779 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-05-21 14:35:39 +00:00
parent 52b3a741d5
commit bc596e1533
1 changed files with 5 additions and 3 deletions

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";
}