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:
parent
52b3a741d5
commit
bc596e1533
|
@ -621,12 +621,14 @@ function wp_dropdown_users( $args = '' ) {
|
||||||
if ( $show_option_all )
|
if ( $show_option_all )
|
||||||
$output .= "\t<option value='0'>$show_option_all</option>\n";
|
$output .= "\t<option value='0'>$show_option_all</option>\n";
|
||||||
|
|
||||||
if ( $show_option_none )
|
if ( $show_option_none ) {
|
||||||
$output .= "\t<option value='-1'>$show_option_none</option>\n";
|
$_selected = selected( -1, $selected, false );
|
||||||
|
$output .= "\t<option value='-1'$_selected>$show_option_none</option>\n";
|
||||||
|
}
|
||||||
|
|
||||||
foreach ( (array) $users as $user ) {
|
foreach ( (array) $users as $user ) {
|
||||||
$user->ID = (int) $user->ID;
|
$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 . ')';
|
$display = !empty($user->$show) ? $user->$show : '('. $user->user_login . ')';
|
||||||
$output .= "\t<option value='$user->ID'$_selected>" . esc_html($display) . "</option>\n";
|
$output .= "\t<option value='$user->ID'$_selected>" . esc_html($display) . "</option>\n";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue