From d0b54885a3e35931da72a9e768d4a70cc2665ac9 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 24 Mar 2017 14:52:26 +0000 Subject: [PATCH] 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 --- src/wp-admin/includes/template.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/wp-admin/includes/template.php b/src/wp-admin/includes/template.php index 3c79d43b37..a4672fdbe0 100644 --- a/src/wp-admin/includes/template.php +++ b/src/wp-admin/includes/template.php @@ -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"; - else - $r .= "\n\t"; + // preselect specified role + if ( $selected == $role ) { + $r .= "\n\t"; + } else { + $r .= "\n\t"; + } } - echo $p . $r; + + echo $r; } /**