Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * Defines message providers (types of messages being sent)
  19   *
  20   * The providers defined on this file are processed and registered into
  21   * the Moodle DB after any install or upgrade operation. All plugins
  22   * support this.
  23   *
  24   * For more information, take a look to the documentation available:
  25   *     - Message API: {@link http://docs.moodle.org/dev/Message_API}
  26   *     - Upgrade API: {@link http://docs.moodle.org/dev/Upgrade_API}
  27   *
  28   * @package   core
  29   * @category  message
  30   * @copyright 2008 onwards Martin Dougiamas  http://dougiamas.com
  31   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  32   */
  33  
  34  defined('MOODLE_INTERNAL') || die();
  35  
  36  $messageproviders = array (
  37  
  38      'newlogin' => array (
  39          'defaults' => array(
  40              'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
  41              'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
  42          ),
  43      ),
  44  
  45      // Notices that an admin might be interested in
  46      'notices' => array (
  47           'capability'  => 'moodle/site:config'
  48      ),
  49  
  50      // Important errors that an admin ought to know about
  51      'errors' => array (
  52           'capability'  => 'moodle/site:config'
  53      ),
  54  
  55      // cron-based notifications about available moodle and/or additional plugin updates
  56      'availableupdate' => array(
  57          'capability' => 'moodle/site:config',
  58          'defaults' => array(
  59              'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED
  60          ),
  61  
  62      ),
  63  
  64      'instantmessage' => array (
  65          'defaults' => array(
  66              'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
  67              'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
  68          ),
  69      ),
  70  
  71      'backup' => array (
  72          'capability'  => 'moodle/site:config'
  73      ),
  74  
  75      // Course creation request notification
  76      'courserequested' => array (
  77          'capability'  => 'moodle/site:approvecourse'
  78      ),
  79  
  80      // Course request approval notification
  81      'courserequestapproved' => array (
  82           'capability'  => 'moodle/course:request',
  83           'defaults' => array(
  84              'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
  85          ),
  86      ),
  87  
  88      // Course request rejection notification
  89      'courserequestrejected' => array (
  90          'capability'  => 'moodle/course:request',
  91          'defaults' => array(
  92              'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
  93          ),
  94      ),
  95  
  96      // Course completed. Requires course completion configured at course level. It does not work with just activity progress.
  97      'coursecompleted' => [
  98          'defaults' => [
  99              'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
 100          ],
 101      ],
 102  
 103      // Course content updated. New content (activities or resources) has been created or existing content updated.
 104      'coursecontentupdated' => array (
 105          'defaults' => array(
 106              'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
 107              'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
 108              'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
 109          ),
 110      ),
 111  
 112      // Badge award notification to a badge recipient.
 113      'badgerecipientnotice' => array (
 114          'defaults' => array(
 115              'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
 116              'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
 117              'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
 118          ),
 119          'capability'  => 'moodle/badges:earnbadge'
 120      ),
 121  
 122      // Badge award notification to a badge creator (mostly cron-based).
 123      'badgecreatornotice' => array (
 124          'defaults' => array(
 125              'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
 126          )
 127      ),
 128  
 129      // A comment was left on a plan.
 130      'competencyplancomment' => array(),
 131  
 132      // A comment was left on a user competency.
 133      'competencyusercompcomment' => array(),
 134  
 135      // User insights.
 136      'insights' => array (
 137          'defaults' => [
 138              'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
 139              'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
 140              'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
 141          ]
 142      ),
 143  
 144      // Message contact requests.
 145      'messagecontactrequests' => [
 146          'defaults' => [
 147              // We don't need to notify in the popup output here because the message drawer
 148              // already notifies users of contact requests.
 149              'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
 150              'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
 151          ]
 152      ],
 153  
 154      // Asyncronhous backup/restore notifications.
 155      'asyncbackupnotification' => array(
 156          'defaults' => array(
 157              'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
 158              'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
 159          )
 160      ),
 161  
 162      'gradenotifications' => [
 163          'defaults' => array(
 164              'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
 165              'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
 166          ),
 167      ],
 168  
 169      // Infected files.
 170      'infected' => array(
 171          'capability'  => 'moodle/site:config',
 172      ),
 173  
 174      // Report builder schedules.
 175      'reportbuilderschedule' => [
 176          'defaults' => [
 177              'email' => MESSAGE_FORCED,
 178          ],
 179      ],
 180  );