From b2f0dc9d10b5165366e0d6d11b621ae2c5fa87b0 Mon Sep 17 00:00:00 2001 From: Cameron Ball Date: Tue, 8 Sep 2015 12:10:07 +0800 Subject: [PATCH] MDL-51307 navigation: hide message button --- lib/outputrenderers.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 3359ffb4c4a..c457b5b1728 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -3937,7 +3937,7 @@ EOD; * @return string HTML for the header bar. */ public function context_header($headerinfo = null, $headinglevel = 1) { - global $DB, $USER; + global $DB, $USER, $CFG; $context = $this->page->context; // Make sure to use the heading if it has been set. if (isset($headerinfo['heading'])) { @@ -3967,7 +3967,7 @@ EOD; $imagedata = $this->user_picture($user, array('size' => 100)); // Check to see if we should be displaying a message button. - if ($USER->id != $user->id && has_capability('moodle/site:sendmessage', $context)) { + if (!empty($CFG->messaging) && $USER->id != $user->id && has_capability('moodle/site:sendmessage', $context)) { $userbuttons = array( 'messages' => array( 'buttontype' => 'message',