Merge branch 'MDL-74893-MOODLE_401_STABLE-fix_auto_login_guest' of https://github.com/praxisdigital/moodle into MOODLE_401_STABLE

This commit is contained in:
Jun Pataleta 2023-07-06 09:14:09 +08:00
commit d584ca7b7f
No known key found for this signature in database
GPG Key ID: F83510526D99E2C7

View File

@ -2747,7 +2747,7 @@ function require_login($courseorid = null, $autologinguest = true, $cm = null, $
// If the user is not even logged in yet then make sure they are.
if (!isloggedin()) {
if ($autologinguest and !empty($CFG->guestloginbutton) and !empty($CFG->autologinguests)) {
if ($autologinguest && !empty($CFG->autologinguests)) {
if (!$guest = get_complete_user_data('id', $CFG->siteguest)) {
// Misconfigured site guest, just redirect to login page.
redirect(get_login_url());