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.



git-svn-id: http://core.svn.wordpress.org/trunk@22687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-11-19 19:23:54 +00:00
parent d88922565e
commit fa76d11e93
1 changed files with 3 additions and 3 deletions

View File

@ -249,10 +249,10 @@ if ( !( IS_PROFILE_PAGE && !$user_can_edit ) ) : ?>
<tr><th><label for="role"><?php _e('Role') ?></label></th>
<td><select name="role" id="role">
<?php
// Get the highest/primary role for this user
// Compare user role against currently editable roles
// TODO: create a function that does this: wp_get_user_role()
$user_roles = $profileuser->roles;
$user_role = array_shift($user_roles);
$user_roles = array_intersect( array_values( $profileuser->roles ), array_keys( get_editable_roles() ) );
$user_role = array_shift( $user_roles );
// print the full list of roles with the primary one selected.
wp_dropdown_roles($user_role);