Moved creation of guest user to login page - this means it can be
trashed any time and it will recreate itself as necessary.
This commit is contained in:
@@ -44,20 +44,6 @@
|
||||
$USER->admin = true;
|
||||
$USER->teacher["$course->id"] = true;
|
||||
|
||||
// This is also a good time to make the Guest User
|
||||
|
||||
$user = NULL;
|
||||
$user->firstname = "Guest";
|
||||
$user->lastname = "User";
|
||||
$user->username = "guest"; // This user is identified by this
|
||||
$user->password = md5("guest");
|
||||
$user->email = "root@localhost";
|
||||
$user->confirmed = 1;
|
||||
$user->timemodified = time();
|
||||
|
||||
if (! $guest->user = insert_record("user", $user)) {
|
||||
notify("Could not create guest user record !!!");
|
||||
}
|
||||
}
|
||||
|
||||
require_login();
|
||||
|
||||
@@ -2,6 +2,23 @@
|
||||
require("../config.php");
|
||||
|
||||
|
||||
// Check if the guest user exists. If not, create one.
|
||||
if (! record_exists("user", "username", "guest")) {
|
||||
$guest->username = "guest";
|
||||
$guest->password = md5("guest");
|
||||
$guest->firstname = "Guest";
|
||||
$guest->lastname = "User";
|
||||
$guest->email = "root@localhost";
|
||||
$guest->description = "This user is a special user that allows read-only access to some courses.";
|
||||
$guest->confirmed = 1;
|
||||
$guest->timemodified= time();
|
||||
|
||||
if (! $guest->id = insert_record("user", $guest)) {
|
||||
notify("Could not create guest user record !!!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (match_referer() && isset($HTTP_POST_VARS)) { // form submitted
|
||||
|
||||
$frm = (object)$HTTP_POST_VARS;
|
||||
|
||||
Reference in New Issue
Block a user