Better handling of users with no role. Props Mark Jaquith. #2809
git-svn-id: http://svn.automattic.com/wordpress/trunk@3859 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -103,11 +103,22 @@ if ( !current_user_can('edit_user', $user_id) )
|
||||
<?php
|
||||
// print_r($profileuser);
|
||||
echo '<select name="role">';
|
||||
$role_list = '';
|
||||
$user_has_role = false;
|
||||
foreach($wp_roles->role_names as $role => $name) {
|
||||
$selected = ($profileuser->has_cap($role)) ? ' selected="selected"' : '';
|
||||
echo "<option value=\"{$role}\"{$selected}>{$name}</option>";
|
||||
if ( $profileuser->has_cap($role) ) {
|
||||
$selected = ' selected="selected"';
|
||||
$user_has_role = true;
|
||||
} else {
|
||||
$selected = '';
|
||||
}
|
||||
$role_list .= "<option value=\"{$role}\"{$selected}>{$name}</option>";
|
||||
}
|
||||
echo '</select>';
|
||||
if ( $user_has_role )
|
||||
$role_list .= '<option value="">' . __('— No role for this blog —') . '</option>';
|
||||
else
|
||||
$role_list .= '<option value="" selected="selected">' . __('— No role for this blog —') . '</option>';
|
||||
echo $role_list . '</select>';
|
||||
?></label></p>
|
||||
|
||||
<p><label><?php _e('First name:') ?><br />
|
||||
|
||||
@@ -313,7 +313,11 @@ foreach($roleclasses as $role => $roleclass) {
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<?php if ( !empty($role) ) : ?>
|
||||
<th colspan="7" align="left"><h3><?php echo $wp_roles->role_names[$role]; ?></h3></th>
|
||||
<?php else : ?>
|
||||
<th colspan="7" align="left"><h3><em><?php _e('No role for this blog'); ?></h3></th>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
<tr class="thead">
|
||||
<th style="text-align: left"><?php _e('ID') ?></th>
|
||||
|
||||
Reference in New Issue
Block a user