Make WordPress Core


Ignore:
Timestamp:
06/10/2006 08:26:26 PM (18 years ago)
Author:
ryan
Message:

Better handling of users with no role. Props Mark Jaquith. #2809

File:
1 edited

Legend:

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

    r3857 r3859  
    104104// print_r($profileuser);
    105105echo '<select name="role">';
     106$role_list = '';
     107$user_has_role = false;
    106108foreach($wp_roles->role_names as $role => $name) {
    107     $selected = ($profileuser->has_cap($role)) ? ' selected="selected"' : '';
    108     echo "<option value=\"{$role}\"{$selected}>{$name}</option>";
    109 }
    110 echo '</select>';
     109    if ( $profileuser->has_cap($role) ) {
     110        $selected = ' selected="selected"';
     111        $user_has_role = true;
     112    } else {
     113        $selected = '';
     114    }
     115    $role_list .= "<option value=\"{$role}\"{$selected}>{$name}</option>";
     116}
     117if ( $user_has_role )
     118    $role_list .= '<option value="">' . __('&mdash; No role for this blog &mdash;') . '</option>';
     119else
     120    $role_list .= '<option value="" selected="selected">' . __('&mdash; No role for this blog &mdash;') . '</option>';
     121echo $role_list . '</select>';
    111122?></label></p>
    112123
Note: See TracChangeset for help on using the changeset viewer.