use wp_dropdown_roles(). Props jeremyclarke. fixes #8764
git-svn-id: https://develop.svn.wordpress.org/trunk@10319 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
823be602f4
commit
2defde173c
@ -245,28 +245,25 @@ do_action('personal_options', $profileuser);
|
|||||||
|
|
||||||
<?php if ( !$is_profile_page ): ?>
|
<?php if ( !$is_profile_page ): ?>
|
||||||
<tr><th><label for="role"><?php _e('Role:') ?></label></th>
|
<tr><th><label for="role"><?php _e('Role:') ?></label></th>
|
||||||
|
<td><select name="role" id="role">
|
||||||
<?php
|
<?php
|
||||||
// print_r($profileuser);
|
// Get the highest/primary role for this user
|
||||||
echo '<td><select name="role" id="role">';
|
// TODO: create a function that does this: wp_get_user_role()
|
||||||
$role_list = '';
|
$user_roles = $profileuser->roles;
|
||||||
$user_has_role = false;
|
$user_role = array_shift($user_roles);
|
||||||
foreach($wp_roles->role_names as $role => $name) {
|
|
||||||
$name = translate_with_context($name);
|
// print the full list of roles with the primary one selected.
|
||||||
if ( $profileuser->has_cap($role) ) {
|
wp_dropdown_roles($user_role);
|
||||||
$selected = ' selected="selected"';
|
|
||||||
$user_has_role = true;
|
// print the 'no role' option. Make it selected if the user has no role yet.
|
||||||
} else {
|
if ( $user_role )
|
||||||
$selected = '';
|
|
||||||
}
|
|
||||||
$role_list .= "<option value=\"{$role}\"{$selected}>{$name}</option>";
|
|
||||||
}
|
|
||||||
if ( $user_has_role )
|
|
||||||
$role_list .= '<option value="">' . __('— No role for this blog —') . '</option>';
|
$role_list .= '<option value="">' . __('— No role for this blog —') . '</option>';
|
||||||
else
|
else
|
||||||
$role_list .= '<option value="" selected="selected">' . __('— No role for this blog —') . '</option>';
|
$role_list .= '<option value="" selected="selected">' . __('— No role for this blog —') . '</option>';
|
||||||
echo $role_list . '</select></td></tr>';
|
|
||||||
?>
|
echo $role_list;?>
|
||||||
<?php endif; ?>
|
</select></td></tr>
|
||||||
|
<?php endif; //!$is_profile_page ?>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th><label for="first_name"><?php _e('First name') ?></label></th>
|
<th><label for="first_name"><?php _e('First name') ?></label></th>
|
||||||
|
Loading…
Reference in New Issue
Block a user