MDL-30811 output: Add support for session notifications
This commit is contained in:
@@ -157,10 +157,18 @@ class manager {
|
||||
public static function init_empty_session() {
|
||||
global $CFG;
|
||||
|
||||
// Backup notifications. These should be preserved across session changes until the user fetches and clears them.
|
||||
$notifications = [];
|
||||
if (isset($GLOBALS['SESSION']->notifications)) {
|
||||
$notifications = $GLOBALS['SESSION']->notifications;
|
||||
}
|
||||
$GLOBALS['SESSION'] = new \stdClass();
|
||||
|
||||
$GLOBALS['USER'] = new \stdClass();
|
||||
$GLOBALS['USER']->id = 0;
|
||||
|
||||
// Restore notifications.
|
||||
$GLOBALS['SESSION']->notifications = $notifications;
|
||||
if (isset($CFG->mnet_localhost_id)) {
|
||||
$GLOBALS['USER']->mnethostid = $CFG->mnet_localhost_id;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user