Users: Don't push the current user's role to the top of the list in wp_dropdown_roles()
.
This brings consistency to the order in which roles are displayed in the `Roles` dropdown when editing users. Props bor0 Fixes #40162 git-svn-id: https://develop.svn.wordpress.org/trunk@40323 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
13f5d04590
commit
d0b54885a3
@ -821,19 +821,21 @@ function parent_dropdown( $default = 0, $parent = 0, $level = 0, $post = null )
|
||||
* @param string $selected Slug for the role that should be already selected.
|
||||
*/
|
||||
function wp_dropdown_roles( $selected = '' ) {
|
||||
$p = '';
|
||||
$r = '';
|
||||
|
||||
$editable_roles = array_reverse( get_editable_roles() );
|
||||
|
||||
foreach ( $editable_roles as $role => $details ) {
|
||||
$name = translate_user_role($details['name'] );
|
||||
if ( $selected == $role ) // preselect specified role
|
||||
$p = "\n\t<option selected='selected' value='" . esc_attr($role) . "'>$name</option>";
|
||||
else
|
||||
$r .= "\n\t<option value='" . esc_attr($role) . "'>$name</option>";
|
||||
// preselect specified role
|
||||
if ( $selected == $role ) {
|
||||
$r .= "\n\t<option selected='selected' value='" . esc_attr( $role ) . "'>$name</option>";
|
||||
} else {
|
||||
$r .= "\n\t<option value='" . esc_attr( $role ) . "'>$name</option>";
|
||||
}
|
||||
}
|
||||
echo $p . $r;
|
||||
|
||||
echo $r;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user