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

Built from https://develop.svn.wordpress.org/trunk@40323


git-svn-id: http://core.svn.wordpress.org/trunk@40230 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2017-03-24 14:53:46 +00:00
parent 6e5e29c5bf
commit 37a638ae8a
2 changed files with 9 additions and 7 deletions

View File

@ -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;
}
/**

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.8-alpha-40322';
$wp_version = '4.8-alpha-40323';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.