mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-05 05:04:31 +00:00
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:
@@ -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'])) {
|
||||
|
||||
Reference in New Issue
Block a user