From 8516afd50719a389d360ed7fadf9027ffda947f8 Mon Sep 17 00:00:00 2001 From: selliott Date: Tue, 9 Mar 2004 21:43:09 +0000 Subject: [PATCH] Added logic to allow confirmation of unconfirmed users. --- admin/user.php | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/admin/user.php b/admin/user.php index 8de53c2cdc..9d95e055a9 100644 --- a/admin/user.php +++ b/admin/user.php @@ -7,6 +7,7 @@ optional_variable($newuser, ""); optional_variable($delete, ""); optional_variable($confirm, ""); + optional_variable($confirmuser, ""); optional_variable($sort, "name"); optional_variable($dir, "ASC"); optional_variable($page, 0); @@ -107,7 +108,23 @@ print_header("$site->shortname: $stredituser", $site->fullname, "$stradministration -> $strusers -> $stredituser"); - if ($delete) { // Delete a selected user, after confirmation + if ($confirmuser) { + if (!$user = get_record("user", "id", "$confirmuser")) { + error("No such user!"); + } + + unset($confirmeduser); + $confirmeduser->id = $confirmuser; + $confirmeduser->confirmed = 1; + $confirmeduser->timemodified = time(); + + if (update_record("user", $confirmeduser)) { + notify(get_string("userconfirmed", "", fullname($user, true)) ); + } else { + notify(get_string("usernotconfirmed", "", fullname($user, true))); + } + + } else if ($delete) { // Delete a selected user, after confirmation if (!$user = get_record("user", "id", "$delete")) { error("No such user!"); } @@ -241,8 +258,8 @@ $users = $nusers; } - $table->head = array ($name, $email, $city, $country, $lastaccess, "", ""); - $table->align = array ("left", "left", "left", "left", "left", "center", "center"); + $table->head = array ($name, $email, $city, $country, $lastaccess, "", "", ""); + $table->align = array ("left", "left", "left", "left", "left", "center", "center", "center"); $table->width = "95%"; foreach ($users as $user) { if ($user->id == $USER->id or $user->username == "changeme") { @@ -255,6 +272,11 @@ } else { $strlastaccess = get_string("never"); } + if ($user->confirmed == 0) { + $confirmbutton = "id\">" . get_string("confirm") . ""; + } else { + $confirmbutton = ""; + } $fullname = fullname($user, true); $table->data[] = array ("id&course=$site->id\">$fullname", "$user->email", @@ -262,7 +284,8 @@ "$user->country", $strlastaccess, "id&course=$site->id\">$stredit", - $deletebutton); + $deletebutton, + $confirmbutton); } echo "
"; -- 2.39.5