Changed invited page to force guest login (even when disabled) instead of no login at all

This commit is contained in:
PMKuipers 2024-08-08 12:23:54 +02:00
parent 8299d4c9d1
commit 073e8e0b28

View File

@ -23,6 +23,12 @@
require_once("../../config.php"); require_once("../../config.php");
// Since this page is externally accessed and validated in a different way, no login is needed. // Since this page is externally accessed and validated in a different way, no login is needed.
// In fact, we need to override the behaviour of require_login to force "guest access" here, even if the configuration says differently
$autologin = $CFG->autologinguests; // Store current guest autologin configuration value.
$CFG->autologinguests = 1; // Override guest autologin configuration value.
require_login(null,true); // Trigger require_login to make sure we have guest access
$CFG->autologinguests = $autologin; // Restore old guest autologin configuration value
unset($autologin);
$systemcontext = context_system::instance(); $systemcontext = context_system::instance();