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

git-svn-id: https://develop.svn.wordpress.org/trunk@2995 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2005-11-06 03:58:52 +00:00
parent 1fb12a1eaa
commit c244bfd360
4 changed files with 31 additions and 1 deletions

View File

@@ -256,6 +256,7 @@ function add_user() {
}
function edit_user($user_id = 0) {
global $current_user, $wp_roles;
if ($user_id != 0) {
$update = true;
@@ -276,6 +277,14 @@ function edit_user($user_id = 0) {
if (isset ($_POST['pass2']))
$pass2 = $_POST['pass2'];
if (isset ($_POST['role'])) {
if($user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap('edit_users'))
$user->role = $_POST['role'];
}
if (isset ($_POST['role'])) {
$user->role = $_POST['role'];
}
if (isset ($_POST['email']))
$user->user_email = wp_specialchars(trim($_POST['email']));
if (isset ($_POST['url'])) {