Create guest user account during installation, fixing bug 2667

This commit is contained in:
gustav_delius 2005-03-03 14:56:19 +00:00
parent 12d2e1e7b7
commit e163bf2d33

View File

@ -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