WordPress.org

Make WordPress Core

Changeset 22687


Ignore:
Timestamp:
11/19/12 19:23:54 (2 years ago)
Author:
nacin
Message:

As wp_dropdown_roles() only prints editable roles, ensure that the
"selected" role passed into it on the user-edit screen is editable.

props johnjamesjacoby. see #22361.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/user-edit.php

    r21927 r22687  
    250250<td><select name="role" id="role"> 
    251251<?php 
    252 // Get the highest/primary role for this user 
     252// Compare user role against currently editable roles 
    253253// TODO: create a function that does this: wp_get_user_role() 
    254 $user_roles = $profileuser->roles; 
    255 $user_role = array_shift($user_roles); 
     254$user_roles = array_intersect( array_values( $profileuser->roles ), array_keys( get_editable_roles() ) ); 
     255$user_role  = array_shift( $user_roles ); 
    256256 
    257257// print the full list of roles with the primary one selected. 
Note: See TracChangeset for help on using the changeset viewer.