MDL-68425 user: Add capability check for messaging
authorderaadt <michaelderaadt@gmail.com>
Thu, 16 Apr 2020 01:47:45 +0000 (11:47 +1000)
committerJake Dallimore <jake@moodle.com>
Thu, 28 May 2020 03:23:42 +0000 (11:23 +0800)
user/index.php

index 3a4ddf1..08169f4 100644 (file)
@@ -367,7 +367,7 @@ if ($bulkoperations) {
     }
     echo html_writer::end_tag('div');
     $displaylist = array();
-    if (!empty($CFG->messaging)) {
+    if (!empty($CFG->messaging) && has_all_capabilities(['moodle/site:sendmessage', 'moodle/course:bulkmessaging'], $context)) {
         $displaylist['#messageselect'] = get_string('messageselectadd');
     }
     if (!empty($CFG->enablenotes) && has_capability('moodle/notes:manage', $context) && $context->id != $frontpagectx->id) {