}
$lang = isset($SESSION->lang) ? $SESSION->lang : $CFG->lang;
complete_user_login($guest, false);
+ $USER->autologinguest = true;
$SESSION->lang = $lang;
} else {
//NOTE: $USER->site check was obsoleted by session test cookie,
* @return void -does not return. Terminates execution!
*/
function default_exception_handler($ex) {
- global $DB, $OUTPUT;
+ global $CFG, $DB, $OUTPUT, $USER, $FULLME, $SESSION;
// detect active db transactions, rollback and log as error
abort_all_db_transactions();
+ if (($ex instanceof required_capability_exception) && !CLI_SCRIPT && !AJAX_SCRIPT && !empty($CFG->autologinguests) && !empty($USER->autologinguest)) {
+ $SESSION->wantsurl = $FULLME;
+ redirect(get_login_url());
+ }
+
$info = get_exception_info($ex);
if (debugging('', DEBUG_MINIMAL)) {