From 48ac42cc30dc8f4404f35c6853ee678ceb0e5498 Mon Sep 17 00:00:00 2001 From: saxmatt Date: Sun, 1 Aug 2004 09:13:50 +0000 Subject: [PATCH] Added ability to edit other users. git-svn-id: http://svn.automattic.com/wordpress/trunk@1507 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/user-edit.php | 209 +++++++++++++++++++++++++++++++++++++++++ wp-admin/users.php | 13 ++- 2 files changed, 221 insertions(+), 1 deletion(-) create mode 100644 wp-admin/user-edit.php diff --git a/wp-admin/user-edit.php b/wp-admin/user-edit.php new file mode 100644 index 0000000000..254382f031 --- /dev/null +++ b/wp-admin/user-edit.php @@ -0,0 +1,209 @@ +user_level >= $user_level) die( __('You do not have permission to edit this user.') ); + +/* checking the nickname has been typed */ +if (empty($_POST["new_nickname"])) { + die (__("ERROR: please enter your nickname (can be the same as your login)")); + return false; +} + +if ($_POST['pass1'] == '') { + if ($_POST['pass2'] != '') + die (__("ERROR: you typed your new password only once. Go back to type it twice.")); + $updatepassword = ''; +} else { + if ($_POST['pass2'] == "") + die (__("ERROR: you typed your new password only once. Go back to type it twice.")); + if ($_POST['pass1'] != $_POST['pass2']) + die (__("ERROR: you typed two different passwords. Go back to correct that.")); + $new_pass = $_POST["pass1"]; + $updatepassword = "user_pass=MD5('$new_pass'), "; +} + +$new_user_login = $_POST['new_user_login']; +$new_firstname = $_POST['new_firstname']; +$new_lastname = $_POST['new_lastname']; +$new_nickname = $_POST['new_nickname']; +$new_nicename = sanitize_title($new_nickname); +$new_icq = $_POST['new_icq']; +$new_aim = $_POST['new_aim']; +$new_msn = $_POST['new_msn']; +$new_yim = $_POST['new_yim']; +$new_email = $_POST['new_email']; +$new_url = $_POST['new_url']; +$new_url = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $new_url) ? $new_url : 'http://' . $new_url; +$new_idmode = $_POST['new_idmode']; +$new_description = $_POST['user_description']; + +$result = $wpdb->query("UPDATE $wpdb->users SET user_login = '$new_user_login', user_firstname = '$new_firstname', $updatepassword user_lastname='$new_lastname', user_nickname='$new_nickname', user_icq='$new_icq', user_email='$new_email', user_url='$new_url', user_aim='$new_aim', user_msn='$new_msn', user_yim='$new_yim', user_idmode='$new_idmode', user_description = '$user_description', user_nicename = '$new_nicename' WHERE ID = $user_id"); + +header("Location: user-edit.php?user_id=$user_id&updated=true"); + +break; + +case 'switchposts': + +$standalone = 1; +require_once('admin-header.php'); + +check_admin_referer(); + +/* TODO: Switch all posts from one user to another user */ + +break; + +default: + +$standalone = 0; +include ('admin-header.php'); + +$edituser = get_userdata($user_id); + +if ($edituser->user_level >= $user_level) die( __('You do not have permission to edit this user.') ); +?> + + + +
+

+
+ + +
+

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
user_level; ?>
user_id); ?>
+
+ +
+ +
Password (Leave blank to stay the same.)') ?> +
+
+

+ + + +

+
+
+ + */ +include('admin-footer.php'); +?> diff --git a/wp-admin/users.php b/wp-admin/users.php index 1d80f6535f..5ff743fa58 100644 --- a/wp-admin/users.php +++ b/wp-admin/users.php @@ -196,6 +196,7 @@ default: +   get_results("SELECT ID FROM $wpdb->users WHERE user_level > 0 ORDER BY ID"); @@ -227,6 +228,10 @@ default: if (($user_level >= 2) and ($user_level > ($user_data->user_level + 1))) echo " ID."&prom=up\">+ "; echo "$numposts"; + echo ''; + if (($user_level >= 2) and ($user_level > $user_data->user_level)) + echo "Edit"; + echo ''; echo ''; } @@ -249,6 +254,7 @@ default: + echo $user_data->user_level; if ($user_level >= 2) echo " ID."&prom=up\">+ "; - echo "\n\n"; + echo "\n"; } + echo ''; + if (($user_level >= 2) and ($user_level > $user_data->user_level)) + echo "Edit"; + echo ''; + echo ''; ?>