From e163bf2d3315db88a67d0a84c30e6ea1817b780b Mon Sep 17 00:00:00 2001 From: gustav_delius Date: Thu, 3 Mar 2005 14:56:19 +0000 Subject: [PATCH] Create guest user account during installation, fixing bug 2667 --- admin/index.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/admin/index.php b/admin/index.php index 5632df5accb..88fe0d70b6f 100644 --- a/admin/index.php +++ b/admin/index.php @@ -256,6 +256,24 @@ if (empty($CFG->siteidentifier)) { // Unique site identification code set_config('siteidentifier', random_string(32)); } + +/// Check if the guest user exists. If not, create one. + if (! record_exists("user", "username", "guest")) { + $guest->auth = "manual"; + $guest->username = "guest"; + $guest->password = md5("guest"); + $guest->firstname = addslashes(get_string("guestuser")); + $guest->lastname = " "; + $guest->email = "root@localhost"; + $guest->description = addslashes(get_string("guestuserinfo")); + $guest->confirmed = 1; + $guest->lang = $CFG->lang; + $guest->timemodified= time(); + + if (! $guest->id = insert_record("user", $guest)) { + notify("Could not create guest user record !!!"); + } + } /// Set up the admin user if (! record_exists("user_admins")) { // No admin user yet