mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
Create guest user account during installation, fixing bug 2667
This commit is contained in:
parent
12d2e1e7b7
commit
e163bf2d33
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user