Make WordPress Core


Ignore:
Timestamp:
11/06/2005 03:58:52 AM (21 years ago)
Author:
ryan
Message:

Show Role in profile and user edit. Don't allow users with edit_users caps to demote themselves. Props: davidhouse, ringmaster. fixes #1825

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-functions.php

    r2979 r2995  
    257257
    258258function edit_user($user_id = 0) {
     259    global $current_user, $wp_roles;
    259260
    260261    if ($user_id != 0) {
     
    277278        $pass2 = $_POST['pass2'];
    278279
     280    if (isset ($_POST['role'])) {
     281        if($user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap('edit_users'))
     282            $user->role = $_POST['role'];
     283    }
     284
     285    if (isset ($_POST['role'])) {
     286        $user->role = $_POST['role'];
     287    }
    279288    if (isset ($_POST['email']))
    280289        $user->user_email = wp_specialchars(trim($_POST['email']));
Note: See TracChangeset for help on using the changeset viewer.