From fa3a661b62acf6671db5c1973e2cf249c91a2103 Mon Sep 17 00:00:00 2001 From: james Date: Wed, 23 Feb 2011 17:09:39 +0000 Subject: [PATCH] Allow superuser to edit other peoples accounts Show pending email if there is one --- user_account.php | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/user_account.php b/user_account.php index 9b81090..a26a503 100644 --- a/user_account.php +++ b/user_account.php @@ -37,8 +37,14 @@ if(!isset($_SESSION['accounts_id'])) { /* Superuser may edit this for any account, if the user is not a superuser, force * the accounts_id to be whatever is in the session */ if($_SESSION['superuser']) { - $accounts_id = intval($_GET['accounts_id']); - if($accounts_id == 0) $accounts_id = $_SESSION['accounts_id']; + if($_GET['accounts_id']) { + $accounts_id = intval($_GET['accounts_id']); + } else if($_GET['users_id']) { + $u=user_load(intval($_GET['users_id'])); + $accounts_id=$u['accounts_id']; + } + else + $accounts_id = $_SESSION['accounts_id']; } else { $accounts_id = $_SESSION['accounts_id']; } @@ -83,8 +89,7 @@ case 'save': } if($save) { - // action_create_set_email($accounts_id, $email); - mysql_query("UPDATE accounts SET email='".mysql_real_escape_string($email)."' WHERE id={$accounts_id}"); + account_set_email($accounts_id,$email); happy_("An email has been sent to %1 to confirm the new email address", array($email)); } } @@ -155,9 +160,7 @@ case 'save': $a = account_load($accounts_id); $d = ''; - $email = $a['email']; $username_link = ($a['link_username_to_email'] == 'yes') ? 'checked="checked"' : ''; - $username = $a['username']; if($_SESSION['password_expired'] == true) { echo error(i18n('Your password has expired. You must choose a new password now.')); @@ -174,19 +177,32 @@ case 'save': - + + - - - + + + + + + + + + + - + + -
Email
name="email" type="text" size="30" value="">
+ name="email" type="text" size="30" value="">
is currently pending confirmation

Username
: id="username" name=username type="text" size="20" value="">
+
id="username" name=username type="text" size="20" value="">
type="checkbox" name="username_link" value="yes" />