]> git.mjollnir.org Git - moodle.git/commitdiff
Added logic to allow confirmation of unconfirmed users.
authorselliott <selliott>
Tue, 9 Mar 2004 21:43:09 +0000 (21:43 +0000)
committerselliott <selliott>
Tue, 9 Mar 2004 21:43:09 +0000 (21:43 +0000)
admin/user.php

index 8de53c2cdc8a0b12cca2b8dae9f4a15d0b23f3cb..9d95e055a9a06eb0b2bccbb52a75796fd13b6b06 100644 (file)
@@ -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);
         print_header("$site->shortname: $stredituser", $site->fullname, 
                      "<a href=\"index.php\">$stradministration</a> -> <a href=\"users.php\">$strusers</a> -> $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!");
             }
             $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") {
             } else {
                 $strlastaccess = get_string("never");
             }
+            if ($user->confirmed == 0) {
+                $confirmbutton = "<a href=\"user.php?confirmuser=$user->id\">" . get_string("confirm") . "</a>";
+            } else {
+                $confirmbutton = "";
+            }
             $fullname = fullname($user, true);
             $table->data[] = array ("<a href=\"../user/view.php?id=$user->id&course=$site->id\">$fullname</a>",
                              "$user->email",
                              "$user->country",
                              $strlastaccess,
                              "<a href=\"../user/edit.php?id=$user->id&course=$site->id\">$stredit</a>",
-                             $deletebutton);
+                             $deletebutton,
+                             $confirmbutton);
         }
 
         echo "<table align=center cellpadding=10><tr><td>";