diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 7fd0926d346..1b055a678dc 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -3221,9 +3221,9 @@ EOD; * @return string HTML for the message menu */ public function message_menu() { - global $USER; + global $CFG, $USER; - if (isloggedin() && !user_not_fully_set_up($USER)) { + if (!empty($CFG->messaging) && isloggedin() && !user_not_fully_set_up($USER)) { $context = [ 'userid' => $USER->id, 'urls' => [