* @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'])) {
$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',