diff --git a/lib/pagelib.php b/lib/pagelib.php index da792eebac4..72b1d1ab0f7 100644 --- a/lib/pagelib.php +++ b/lib/pagelib.php @@ -1611,7 +1611,8 @@ class moodle_page { } $mnetpeertheme = ''; - if (isloggedin() and isset($CFG->mnet_localhost_id) and $USER->mnethostid != $CFG->mnet_localhost_id) { + $mnetvarsok = isset($CFG->mnet_localhost_id) && isset($USER->mnethostid); + if (isloggedin() and $mnetvarsok and $USER->mnethostid != $CFG->mnet_localhost_id) { require_once($CFG->dirroot.'/mnet/peer.php'); $mnetpeer = new mnet_peer(); $mnetpeer->set_id($USER->mnethostid);