WordPress.org

Make WordPress Core

Changeset 40323


Ignore:
Timestamp:
03/24/17 14:52:26 (5 months ago)
Author:
johnbillion
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/template.php

    r40059 r40323  
    822822 */ 
    823823function wp_dropdown_roles( $selected = '' ) { 
    824     $p = ''; 
    825824    $r = ''; 
    826825 
     
    829828    foreach ( $editable_roles as $role => $details ) { 
    830829        $name = translate_user_role($details['name'] ); 
    831         if ( $selected == $role ) // preselect specified role 
    832             $p = "\n\t<option selected='selected' value='" . esc_attr($role) . "'>$name</option>"; 
    833         else 
    834             $r .= "\n\t<option value='" . esc_attr($role) . "'>$name</option>"; 
    835     } 
    836     echo $p . $r; 
     830        // preselect specified role 
     831        if ( $selected == $role ) { 
     832            $r .= "\n\t<option selected='selected' value='" . esc_attr( $role ) . "'>$name</option>"; 
     833        } else { 
     834            $r .= "\n\t<option value='" . esc_attr( $role ) . "'>$name</option>"; 
     835        } 
     836    } 
     837 
     838    echo $r; 
    837839} 
    838840 
Note: See TracChangeset for help on using the changeset viewer.