<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Peterburnett</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Peterburnett"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/Special:Contributions/Peterburnett"/>
	<updated>2026-09-16T15:05:16Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=version.php&amp;diff=56863</id>
		<title>version.php</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=version.php&amp;diff=56863"/>
		<updated>2020-01-23T05:55:12Z</updated>

		<summary type="html">&lt;p&gt;Peterburnett: Changed incompatible. The commit message contained incorrect behaviour&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is an essential file expected to be located in the root directory of the plugin.&lt;br /&gt;
&lt;br /&gt;
It contains a number of properties, which are used during the plugin installation and upgrade process. It allows to make sure the plugin is compatible with the given Moodle site, as well as spotting whether an upgrade is needed.&lt;br /&gt;
&lt;br /&gt;
The file is a standard PHP file, starting with an opening &#039;&amp;amp;lt;?php&#039; tag and defining the following variables:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; There was an exception for [[Activity modules]]. In the past, activity modules used &amp;lt;tt&amp;gt;$module-&amp;gt;&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;$plugin-&amp;gt;&amp;lt;/tt&amp;gt; in their version.php files. The &amp;lt;tt&amp;gt;$plugin-&amp;gt;&amp;lt;/tt&amp;gt; notation support for activity modules was added in Moodle 2.5 (MDL-38121) and became recommended. Support for legacy &amp;lt;tt&amp;gt;$module-&amp;gt;&amp;lt;/tt&amp;gt; was dropped in Moodle 3.0 (MDL-43896).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; Support for &amp;lt;tt&amp;gt;$plugin-&amp;gt;supported =&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;$plugin-&amp;gt;incompatible =&amp;lt;/tt&amp;gt; was added in Moodle 3.9 (MDL-59562).&lt;br /&gt;
&lt;br /&gt;
== Plugin version properties ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property&lt;br /&gt;
! Type&lt;br /&gt;
! Status&lt;br /&gt;
! Description and example&lt;br /&gt;
|- style=&amp;quot;vertical-align:top&amp;quot;&lt;br /&gt;
| style=&amp;quot;min-width:200px&amp;quot; | &#039;&#039;&#039;$plugin-&amp;gt;component&#039;&#039;&#039;&lt;br /&gt;
| string&lt;br /&gt;
| required&amp;lt;sup&amp;gt;*&amp;lt;/sup&amp;gt;&lt;br /&gt;
| The full [[Frankenstyle|frankenstyle]] component name in the form of plugintype_pluginname. It is used during the installation and upgrade process for diagnostics and validation purposes to make sure the plugin code has been deployed to the correct location within the Moodle code tree.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;) Required since Moodle 3.0, strongly recommended for earlier versions (MDL-48494).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;$plugin-&amp;gt;component = &#039;block_foobar&#039;; // Declare the type and name of this plugin.&amp;lt;/code&amp;gt;&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;$plugin-&amp;gt;version&#039;&#039;&#039;&lt;br /&gt;
| integer&lt;br /&gt;
| required&lt;br /&gt;
| The version number of the plugin. The format is partially date based with the form YYYYMMDDXX where XX is an incremental counter for the given year (YYYY), month (MM) and date (DD) of the plugin version&#039;s release. Every new plugin version must have this number increased in this file, which is detected by Moodle core and the upgrade process is triggered.&lt;br /&gt;
&lt;br /&gt;
In case of linear development (i.e. there is just one branch of the plugin maintained), the XX counter should stay with the initial 00 value unless multiple versions are released on the same date.&lt;br /&gt;
&lt;br /&gt;
If multiple stable branches of the plugin are maintained, the date part YYYYMMDD should be frozen at the branch forking date and the XX is used for incrementing the value on the given stable branch (allowing up to 100 updates on the given stable branch). The key point is that the version number is always increased both horizontally (within the same stable branch, more recent updates have higher XX than any previous one) and vertically (between any two stable branches, the more recent branch has YYYYMMDD00 higher than the older stable branch). Pay attention to this. It&#039;s easy to mess up and hard to fix.&lt;br /&gt;
&lt;br /&gt;
See [https://moodle.org/mod/forum/discuss.php?d=275635#p1184986] for an example of versioning scheme on multiple branches.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;$plugin-&amp;gt;version = 2014052000; // Plugin released on 20th May 2014.&amp;lt;/code&amp;gt;&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;$plugin-&amp;gt;requires&#039;&#039;&#039;&lt;br /&gt;
| integer&lt;br /&gt;
| recommended&lt;br /&gt;
| Specifies the minimum version number of Moodle core that this plugin requires. It is not possible to install it to earlier Moodle version. Moodle core&#039;s version number is defined in the file version.php located in Moodle root directory, in the &amp;lt;tt&amp;gt;$version&amp;lt;/tt&amp;gt; variable.&lt;br /&gt;
&lt;br /&gt;
Note that Moodle core extends the version numbering scheme and has inbuilt support for decimal versioning (such as &amp;lt;tt&amp;gt;$version = 2014051200.01;&amp;lt;/tt&amp;gt;). The decimal part is used for incremental (weekly) builds. Plugins should not rely on a particular weekly build so they use just the whole number part of the Moodle core&#039;s version in this field.&lt;br /&gt;
&lt;br /&gt;
See [[Releases]] for the full list of Moodle core version numbers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;$plugin-&amp;gt;requires = 2014051200; // Moodle 2.7.0 is required.&amp;lt;/code&amp;gt;&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;$plugin-&amp;gt;supported&#039;&#039;&#039;&lt;br /&gt;
| array of two ascending integers&lt;br /&gt;
| optional&lt;br /&gt;
| Specifies a range of branch numbers of supported versions, inclusive. Moodle versions that are outside of this range will produce a message notifying at install time, but will allow for installation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;$plugin-&amp;gt;supported = [37,39]; // Moodle 3.7.x, 3.8.x and 3.9.x are supported.&amp;lt;/code&amp;gt;&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;$plugin-&amp;gt;incompatible&#039;&#039;&#039;&lt;br /&gt;
| integer&lt;br /&gt;
| optional&lt;br /&gt;
| Specifies the latest incompatible Moodle major branch. Any Moodle versions including and above this will be prevented from installing the plugin, and a message will be given when attempting installation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;$plugin-&amp;gt;incompatible = 36; // Moodle 3.6.x and later are incompatible.&amp;lt;/code&amp;gt;&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;$plugin-&amp;gt;cron&#039;&#039;&#039;&lt;br /&gt;
| integer&lt;br /&gt;
| discouraged*&lt;br /&gt;
| Allows to throttle the plugin&#039;s cron function calls. The set value represents a minimal required gap in seconds between two calls of the plugin&#039;s cron function. Note that the cron function is not supported in all plugin types (also note that, while the cron function &#039;&#039;&#039;is&#039;&#039;&#039; supported for authentication plugins, it is run every time the cron script runs, regardless of this value in version.php). This value is stored in the database. After changing this value, the version number must be incremented. For activity modules, if this value is not set or 0 the cron function is disabled.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;) Starting with Moodle 2.7, plugin developers are encouraged to use the [[Task API|scheduled task API]] instead of the cron function feature.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;$plugin-&amp;gt;cron = 300; // Do not execute this plugin&#039;s cron more often than every five minutes.&amp;lt;/code&amp;gt;&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;$plugin-&amp;gt;maturity&#039;&#039;&#039;&lt;br /&gt;
| enum&lt;br /&gt;
| recommended&lt;br /&gt;
| Declares the maturity level of this plugin version, that is how stable it is. This affects the [[:en:Available update notifications|available update notifications]] feature in Moodle. Administrators can configure their site so that they are not notified about an available update unless it has certain maturity level declared.&lt;br /&gt;
&lt;br /&gt;
Supported value is any of the predefined constants &amp;lt;tt&amp;gt;MATURITY_ALPHA, MATURITY_BETA, MATURITY_RC&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;MATURITY_STABLE&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;$plugin-&amp;gt;maturity = MATURITY_STABLE; // This is considered as ready for production sites.&amp;lt;/code&amp;gt;&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;$plugin-&amp;gt;release&#039;&#039;&#039;&lt;br /&gt;
| string&lt;br /&gt;
| recommended&lt;br /&gt;
| Human readable version name that should help to identify each release of the plugin. It can be anything you like although it is recommended to choose a pattern and stick with it. Usually it is a simple version like &amp;lt;tt&amp;gt;2.1&amp;lt;/tt&amp;gt; but some plugin authors use more sophisticated schemes or follow the upstream release name if the plugin represents a wrapper for another program.&lt;br /&gt;
&lt;br /&gt;
It is a good practise to tag the code in the source code management system for each plugin release and then make the tag names matching this release name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;$plugin-&amp;gt;release = &#039;v2.7-r1&#039;; // This is our first revision for Moodle 2.7.x branch.&amp;lt;/code&amp;gt;&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
| &#039;&#039;&#039;$plugin-&amp;gt;dependencies&#039;&#039;&#039;&lt;br /&gt;
| array&lt;br /&gt;
| optional&lt;br /&gt;
| Allows to declare explicit dependency on other plugin(s) for this plugin to work. Moodle core checks these declared dependencies and will not allow the plugin installation and/or upgrade until all dependencies are satisfied.&lt;br /&gt;
&lt;br /&gt;
Each element in the array represents an dependency on another plugin. The key (string) in the array is the component (frankenstyle) name of the other plugin. The value (integer) is the version of the other plugin we require. The predefined constant &amp;lt;tt&amp;gt;ANY_VERSION&amp;lt;/tt&amp;gt; can be used if we do not depend on a particular version (we just need the other plugin present).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;$plugin-&amp;gt;dependencies = array(&lt;br /&gt;
    &#039;mod_foo&#039; =&amp;gt; ANY_VERSION,   // The Foo activity must be present (any version).&lt;br /&gt;
    &#039;enrol_bar&#039; =&amp;gt; 2014020300, // The Bar enrolment plugin version 2014020300 or higher must be present.&lt;br /&gt;
);&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== File template ==&lt;br /&gt;
&lt;br /&gt;
Here is a template for the plugin&#039;s version.php file to copy and paste:&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// This file is part of Moodle - http://moodle.org/&lt;br /&gt;
//&lt;br /&gt;
// Moodle is free software: you can redistribute it and/or modify&lt;br /&gt;
// it under the terms of the GNU General Public License as published by&lt;br /&gt;
// the Free Software Foundation, either version 3 of the License, or&lt;br /&gt;
// (at your option) any later version.&lt;br /&gt;
//&lt;br /&gt;
// Moodle is distributed in the hope that it will be useful,&lt;br /&gt;
// but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the&lt;br /&gt;
// GNU General Public License for more details.&lt;br /&gt;
//&lt;br /&gt;
// You should have received a copy of the GNU General Public License&lt;br /&gt;
// along with Moodle.  If not, see &amp;lt;http://www.gnu.org/licenses/&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * @package   plugintype_pluginname&lt;br /&gt;
 * @copyright 2020, You Name &amp;lt;your@email.address&amp;gt;&lt;br /&gt;
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
defined(&#039;MOODLE_INTERNAL&#039;) || die();&lt;br /&gt;
&lt;br /&gt;
$plugin-&amp;gt;version = TODO;&lt;br /&gt;
$plugin-&amp;gt;requires = TODO;&lt;br /&gt;
$plugin-&amp;gt;supported = TODO;   // Available as of Moodle 3.9.0 or later.&lt;br /&gt;
$plugin-&amp;gt;incompatible = TODO;   // Available as of Moodle 3.9.0 or later.&lt;br /&gt;
$plugin-&amp;gt;component = &#039;TODO_FRANKENSTYLE&#039;;&lt;br /&gt;
$plugin-&amp;gt;maturity = MATURITY_STABLE;&lt;br /&gt;
$plugin-&amp;gt;release = &#039;TODO&#039;;&lt;br /&gt;
&lt;br /&gt;
$plugin-&amp;gt;dependencies = [&lt;br /&gt;
    &#039;mod_forum&#039; =&amp;gt; ANY_VERSION,&lt;br /&gt;
    &#039;mod_data&#039; =&amp;gt; TODO&lt;br /&gt;
];&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Moodle versions]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Plugins]]&lt;/div&gt;</summary>
		<author><name>Peterburnett</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Login_callbacks&amp;diff=56543</id>
		<title>Login callbacks</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Login_callbacks&amp;diff=56543"/>
		<updated>2019-10-15T04:29:01Z</updated>

		<summary type="html">&lt;p&gt;Peterburnett: /* post_signup_requests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are cases where we want any plugin to do some check or action as part of the require_login check or related things around logging in or passwords but which are not handled by an authentication plugin.&lt;br /&gt;
&lt;br /&gt;
== after_require_login ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.7}}&lt;br /&gt;
&lt;br /&gt;
This callback allow a plugin to add additional behavior after require_login is called. Some use cases:&lt;br /&gt;
&lt;br /&gt;
* replacing the sitepolicy feature with a more robust / advanced version&lt;br /&gt;
* augmenting the &#039;user fully setup&#039; workflow to add more steps but outside their profile editing page&lt;br /&gt;
* adding extra layers of checks, eg an ip address check but doing this across whole courses instead of at the sitelevel which is too coarse, or at the activity level which is too fine.&lt;br /&gt;
* enforcing various types of course visibility dependencies, eg &#039;before you can do course X you need to complete course Y&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_after_require_login() {&lt;br /&gt;
    if (should_divert()) {&lt;br /&gt;
        redirect($somewhere);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Implemented in https://tracker.moodle.org/browse/MDL-60470&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== check_password_policy ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.6}}&lt;br /&gt;
&lt;br /&gt;
This callback allows a plugin to add additional password tests.&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-61694&lt;br /&gt;
&lt;br /&gt;
== print_password_policy ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
This callback allows a plugin to explain the additional password added via check_password_policy&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66278&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== pre_signup_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.5}}&lt;br /&gt;
&lt;br /&gt;
eg to do actions before sign up such as acceptance of policies, validations, etc&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_pre_signup_requests() {&lt;br /&gt;
   // Do some special policy&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-61485&lt;br /&gt;
&lt;br /&gt;
== extend_change_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for injection of additional form elements into the change password form, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_extend_change_password_form($mform, $user) {&lt;br /&gt;
   // Inject a static element of the user&#039;s username&lt;br /&gt;
   $mform-&amp;gt;addElement(&#039;static&#039;, &#039;injectedstatic&#039;, $user-&amp;gt;username);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== extend_set_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for injection of additional form elements into the set password form, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_extend_set_password_form($mform, $user) {&lt;br /&gt;
   // Inject a static element of the user&#039;s username&lt;br /&gt;
   $mform-&amp;gt;addElement(&#039;static&#039;, &#039;injectedstatic&#039;, $user-&amp;gt;username);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== extend_forgot_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for injection of additional form elements into the forgot password form, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_extend_forgot_password_form($mform) {&lt;br /&gt;
   // Inject a static element of the word &#039;injected&#039;&lt;br /&gt;
   $mform-&amp;gt;addElement(&#039;static&#039;, &#039;injectedstatic&#039;, &#039;injected&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== extend_signup_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for injection of additional form elements into the forgot password form, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_extend_signup_form($mform) {&lt;br /&gt;
   // Inject a static element of the word &#039;injected&#039;&lt;br /&gt;
   $mform-&amp;gt;addElement(&#039;static&#039;, &#039;injectedstatic&#039;, &#039;injected&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== validate_extend_change_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for additional validation of existing and additional form elements, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_validate_extend_change_password_form($data, $user) {&lt;br /&gt;
   // Validate that an injected elements equals the word &#039;test&#039;&lt;br /&gt;
  $errors = array();&lt;br /&gt;
  if ($data[&#039;injectedtext&#039;] != &#039;test&#039;) {&lt;br /&gt;
      $errors[&#039;injectedtext&#039;] = &#039;wrong&#039;;&lt;br /&gt;
  }&lt;br /&gt;
  return $errors;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== validate_extend_set_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for additional validation of existing and additional form elements, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_validate_extend_set_password_form($data, $user) {&lt;br /&gt;
   // Validate that an injected elements equals the word &#039;test&#039;&lt;br /&gt;
  $errors = array();&lt;br /&gt;
  if ($data[&#039;injectedtext&#039;] != &#039;test&#039;) {&lt;br /&gt;
      $errors[&#039;injectedtext&#039;] = &#039;wrong&#039;;&lt;br /&gt;
  }&lt;br /&gt;
  return $errors;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== validate_extend_forgot_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for additional validation of existing and additional form elements, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_validate_extend_forgot_password_form($data) {&lt;br /&gt;
   // Validate that an injected elements equals the word &#039;test&#039;&lt;br /&gt;
  $errors = array();&lt;br /&gt;
  if ($data[&#039;injectedtext&#039;] != &#039;test&#039;) {&lt;br /&gt;
      $errors[&#039;injectedtext&#039;] = &#039;wrong&#039;;&lt;br /&gt;
  }&lt;br /&gt;
  return $errors;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== validate_extend_signup_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for additional validation of existing and additional form elements, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_validate_extend_signup_form($data) {&lt;br /&gt;
   // Validate that an injected elements equals the word &#039;test&#039;&lt;br /&gt;
  $errors = array();&lt;br /&gt;
  if ($data[&#039;injectedtext&#039;] != &#039;test&#039;) {&lt;br /&gt;
      $errors[&#039;injectedtext&#039;] = &#039;wrong&#039;;&lt;br /&gt;
  }&lt;br /&gt;
  return $errors;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== post_change_password_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: Fire any additional actions required after a user changes their password. This function is passed the submitted form data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_post_change_password_requests($data) {&lt;br /&gt;
   // Display a popup message that echoes what a user submitted in an injected element&lt;br /&gt;
   $message = (&#039;post_change_password_request - Input: &#039;.$data-&amp;gt;injectedtext);&lt;br /&gt;
   echo &amp;quot;&amp;lt;script type=&#039;text/javascript&#039;&amp;gt;alert(&#039;$message&#039;);&amp;lt;/script&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== post_set_password_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: Fire any additional actions required after a user resets their password. This function is passed the submitted form data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_post_set_password_requests($data) {&lt;br /&gt;
   // Display a popup message that echoes what a user submitted in an injected element&lt;br /&gt;
   $message = (&#039;post_set_password_request - Input: &#039;.$data-&amp;gt;injectedtext);&lt;br /&gt;
   echo &amp;quot;&amp;lt;script type=&#039;text/javascript&#039;&amp;gt;alert(&#039;$message&#039;);&amp;lt;/script&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== post_forgot_password_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: Fire any additional actions required after a user submits a password reset request. This function is passed the submitted form data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_post_forgot_password_requests($data) {&lt;br /&gt;
   // Display a popup message that echoes what a user submitted in an injected element&lt;br /&gt;
   $message = (&#039;post_forgot_password_request - Input: &#039;.$data-&amp;gt;injectedtext);&lt;br /&gt;
   echo &amp;quot;&amp;lt;script type=&#039;text/javascript&#039;&amp;gt;alert(&#039;$message&#039;);&amp;lt;/script&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== post_signup_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: Fire any additional actions required after a user creates an account. This function is passed the submitted form data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_post_signup_requests($data) {&lt;br /&gt;
   // Display a popup message that echoes what a user submitted in an injected element&lt;br /&gt;
   $message = (&#039;post_signup_request - Input: &#039;.$data-&amp;gt;injectedtext);&lt;br /&gt;
   echo &amp;quot;&amp;lt;script type=&#039;text/javascript&#039;&amp;gt;alert(&#039;$message&#039;);&amp;lt;/script&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;/div&gt;</summary>
		<author><name>Peterburnett</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Login_callbacks&amp;diff=56542</id>
		<title>Login callbacks</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Login_callbacks&amp;diff=56542"/>
		<updated>2019-10-15T04:28:48Z</updated>

		<summary type="html">&lt;p&gt;Peterburnett: /* post_forgot_password_requests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are cases where we want any plugin to do some check or action as part of the require_login check or related things around logging in or passwords but which are not handled by an authentication plugin.&lt;br /&gt;
&lt;br /&gt;
== after_require_login ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.7}}&lt;br /&gt;
&lt;br /&gt;
This callback allow a plugin to add additional behavior after require_login is called. Some use cases:&lt;br /&gt;
&lt;br /&gt;
* replacing the sitepolicy feature with a more robust / advanced version&lt;br /&gt;
* augmenting the &#039;user fully setup&#039; workflow to add more steps but outside their profile editing page&lt;br /&gt;
* adding extra layers of checks, eg an ip address check but doing this across whole courses instead of at the sitelevel which is too coarse, or at the activity level which is too fine.&lt;br /&gt;
* enforcing various types of course visibility dependencies, eg &#039;before you can do course X you need to complete course Y&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_after_require_login() {&lt;br /&gt;
    if (should_divert()) {&lt;br /&gt;
        redirect($somewhere);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Implemented in https://tracker.moodle.org/browse/MDL-60470&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== check_password_policy ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.6}}&lt;br /&gt;
&lt;br /&gt;
This callback allows a plugin to add additional password tests.&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-61694&lt;br /&gt;
&lt;br /&gt;
== print_password_policy ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
This callback allows a plugin to explain the additional password added via check_password_policy&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66278&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== pre_signup_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.5}}&lt;br /&gt;
&lt;br /&gt;
eg to do actions before sign up such as acceptance of policies, validations, etc&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_pre_signup_requests() {&lt;br /&gt;
   // Do some special policy&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-61485&lt;br /&gt;
&lt;br /&gt;
== extend_change_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for injection of additional form elements into the change password form, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_extend_change_password_form($mform, $user) {&lt;br /&gt;
   // Inject a static element of the user&#039;s username&lt;br /&gt;
   $mform-&amp;gt;addElement(&#039;static&#039;, &#039;injectedstatic&#039;, $user-&amp;gt;username);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== extend_set_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for injection of additional form elements into the set password form, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_extend_set_password_form($mform, $user) {&lt;br /&gt;
   // Inject a static element of the user&#039;s username&lt;br /&gt;
   $mform-&amp;gt;addElement(&#039;static&#039;, &#039;injectedstatic&#039;, $user-&amp;gt;username);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== extend_forgot_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for injection of additional form elements into the forgot password form, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_extend_forgot_password_form($mform) {&lt;br /&gt;
   // Inject a static element of the word &#039;injected&#039;&lt;br /&gt;
   $mform-&amp;gt;addElement(&#039;static&#039;, &#039;injectedstatic&#039;, &#039;injected&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== extend_signup_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for injection of additional form elements into the forgot password form, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_extend_signup_form($mform) {&lt;br /&gt;
   // Inject a static element of the word &#039;injected&#039;&lt;br /&gt;
   $mform-&amp;gt;addElement(&#039;static&#039;, &#039;injectedstatic&#039;, &#039;injected&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== validate_extend_change_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for additional validation of existing and additional form elements, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_validate_extend_change_password_form($data, $user) {&lt;br /&gt;
   // Validate that an injected elements equals the word &#039;test&#039;&lt;br /&gt;
  $errors = array();&lt;br /&gt;
  if ($data[&#039;injectedtext&#039;] != &#039;test&#039;) {&lt;br /&gt;
      $errors[&#039;injectedtext&#039;] = &#039;wrong&#039;;&lt;br /&gt;
  }&lt;br /&gt;
  return $errors;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== validate_extend_set_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for additional validation of existing and additional form elements, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_validate_extend_set_password_form($data, $user) {&lt;br /&gt;
   // Validate that an injected elements equals the word &#039;test&#039;&lt;br /&gt;
  $errors = array();&lt;br /&gt;
  if ($data[&#039;injectedtext&#039;] != &#039;test&#039;) {&lt;br /&gt;
      $errors[&#039;injectedtext&#039;] = &#039;wrong&#039;;&lt;br /&gt;
  }&lt;br /&gt;
  return $errors;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== validate_extend_forgot_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for additional validation of existing and additional form elements, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_validate_extend_forgot_password_form($data) {&lt;br /&gt;
   // Validate that an injected elements equals the word &#039;test&#039;&lt;br /&gt;
  $errors = array();&lt;br /&gt;
  if ($data[&#039;injectedtext&#039;] != &#039;test&#039;) {&lt;br /&gt;
      $errors[&#039;injectedtext&#039;] = &#039;wrong&#039;;&lt;br /&gt;
  }&lt;br /&gt;
  return $errors;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== validate_extend_signup_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for additional validation of existing and additional form elements, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_validate_extend_signup_form($data) {&lt;br /&gt;
   // Validate that an injected elements equals the word &#039;test&#039;&lt;br /&gt;
  $errors = array();&lt;br /&gt;
  if ($data[&#039;injectedtext&#039;] != &#039;test&#039;) {&lt;br /&gt;
      $errors[&#039;injectedtext&#039;] = &#039;wrong&#039;;&lt;br /&gt;
  }&lt;br /&gt;
  return $errors;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== post_change_password_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: Fire any additional actions required after a user changes their password. This function is passed the submitted form data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_post_change_password_requests($data) {&lt;br /&gt;
   // Display a popup message that echoes what a user submitted in an injected element&lt;br /&gt;
   $message = (&#039;post_change_password_request - Input: &#039;.$data-&amp;gt;injectedtext);&lt;br /&gt;
   echo &amp;quot;&amp;lt;script type=&#039;text/javascript&#039;&amp;gt;alert(&#039;$message&#039;);&amp;lt;/script&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== post_set_password_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: Fire any additional actions required after a user resets their password. This function is passed the submitted form data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_post_set_password_requests($data) {&lt;br /&gt;
   // Display a popup message that echoes what a user submitted in an injected element&lt;br /&gt;
   $message = (&#039;post_set_password_request - Input: &#039;.$data-&amp;gt;injectedtext);&lt;br /&gt;
   echo &amp;quot;&amp;lt;script type=&#039;text/javascript&#039;&amp;gt;alert(&#039;$message&#039;);&amp;lt;/script&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== post_forgot_password_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: Fire any additional actions required after a user submits a password reset request. This function is passed the submitted form data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_post_forgot_password_requests($data) {&lt;br /&gt;
   // Display a popup message that echoes what a user submitted in an injected element&lt;br /&gt;
   $message = (&#039;post_forgot_password_request - Input: &#039;.$data-&amp;gt;injectedtext);&lt;br /&gt;
   echo &amp;quot;&amp;lt;script type=&#039;text/javascript&#039;&amp;gt;alert(&#039;$message&#039;);&amp;lt;/script&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== post_signup_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: Fire any additional actions required after a user creates an account. This function is passed the submitted form data.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_post_signup_requests($data) {&lt;br /&gt;
   // Display a popup message that echoes what a user submitted in an injected element&lt;br /&gt;
   $message = (&#039;post_signup_request - Input: &#039;.$data-&amp;gt;injectedtext);&lt;br /&gt;
   echo &amp;quot;&amp;lt;script type=&#039;text/javascript&#039;&amp;gt;alert(&#039;$message&#039;);&amp;lt;/script&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;/div&gt;</summary>
		<author><name>Peterburnett</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Login_callbacks&amp;diff=56541</id>
		<title>Login callbacks</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Login_callbacks&amp;diff=56541"/>
		<updated>2019-10-15T04:28:34Z</updated>

		<summary type="html">&lt;p&gt;Peterburnett: /* post_set_password_requests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are cases where we want any plugin to do some check or action as part of the require_login check or related things around logging in or passwords but which are not handled by an authentication plugin.&lt;br /&gt;
&lt;br /&gt;
== after_require_login ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.7}}&lt;br /&gt;
&lt;br /&gt;
This callback allow a plugin to add additional behavior after require_login is called. Some use cases:&lt;br /&gt;
&lt;br /&gt;
* replacing the sitepolicy feature with a more robust / advanced version&lt;br /&gt;
* augmenting the &#039;user fully setup&#039; workflow to add more steps but outside their profile editing page&lt;br /&gt;
* adding extra layers of checks, eg an ip address check but doing this across whole courses instead of at the sitelevel which is too coarse, or at the activity level which is too fine.&lt;br /&gt;
* enforcing various types of course visibility dependencies, eg &#039;before you can do course X you need to complete course Y&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_after_require_login() {&lt;br /&gt;
    if (should_divert()) {&lt;br /&gt;
        redirect($somewhere);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Implemented in https://tracker.moodle.org/browse/MDL-60470&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== check_password_policy ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.6}}&lt;br /&gt;
&lt;br /&gt;
This callback allows a plugin to add additional password tests.&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-61694&lt;br /&gt;
&lt;br /&gt;
== print_password_policy ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
This callback allows a plugin to explain the additional password added via check_password_policy&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66278&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== pre_signup_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.5}}&lt;br /&gt;
&lt;br /&gt;
eg to do actions before sign up such as acceptance of policies, validations, etc&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_pre_signup_requests() {&lt;br /&gt;
   // Do some special policy&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-61485&lt;br /&gt;
&lt;br /&gt;
== extend_change_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for injection of additional form elements into the change password form, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_extend_change_password_form($mform, $user) {&lt;br /&gt;
   // Inject a static element of the user&#039;s username&lt;br /&gt;
   $mform-&amp;gt;addElement(&#039;static&#039;, &#039;injectedstatic&#039;, $user-&amp;gt;username);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== extend_set_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for injection of additional form elements into the set password form, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_extend_set_password_form($mform, $user) {&lt;br /&gt;
   // Inject a static element of the user&#039;s username&lt;br /&gt;
   $mform-&amp;gt;addElement(&#039;static&#039;, &#039;injectedstatic&#039;, $user-&amp;gt;username);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== extend_forgot_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for injection of additional form elements into the forgot password form, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_extend_forgot_password_form($mform) {&lt;br /&gt;
   // Inject a static element of the word &#039;injected&#039;&lt;br /&gt;
   $mform-&amp;gt;addElement(&#039;static&#039;, &#039;injectedstatic&#039;, &#039;injected&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== extend_signup_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for injection of additional form elements into the forgot password form, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_extend_signup_form($mform) {&lt;br /&gt;
   // Inject a static element of the word &#039;injected&#039;&lt;br /&gt;
   $mform-&amp;gt;addElement(&#039;static&#039;, &#039;injectedstatic&#039;, &#039;injected&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== validate_extend_change_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for additional validation of existing and additional form elements, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_validate_extend_change_password_form($data, $user) {&lt;br /&gt;
   // Validate that an injected elements equals the word &#039;test&#039;&lt;br /&gt;
  $errors = array();&lt;br /&gt;
  if ($data[&#039;injectedtext&#039;] != &#039;test&#039;) {&lt;br /&gt;
      $errors[&#039;injectedtext&#039;] = &#039;wrong&#039;;&lt;br /&gt;
  }&lt;br /&gt;
  return $errors;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== validate_extend_set_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for additional validation of existing and additional form elements, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_validate_extend_set_password_form($data, $user) {&lt;br /&gt;
   // Validate that an injected elements equals the word &#039;test&#039;&lt;br /&gt;
  $errors = array();&lt;br /&gt;
  if ($data[&#039;injectedtext&#039;] != &#039;test&#039;) {&lt;br /&gt;
      $errors[&#039;injectedtext&#039;] = &#039;wrong&#039;;&lt;br /&gt;
  }&lt;br /&gt;
  return $errors;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== validate_extend_forgot_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for additional validation of existing and additional form elements, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_validate_extend_forgot_password_form($data) {&lt;br /&gt;
   // Validate that an injected elements equals the word &#039;test&#039;&lt;br /&gt;
  $errors = array();&lt;br /&gt;
  if ($data[&#039;injectedtext&#039;] != &#039;test&#039;) {&lt;br /&gt;
      $errors[&#039;injectedtext&#039;] = &#039;wrong&#039;;&lt;br /&gt;
  }&lt;br /&gt;
  return $errors;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== validate_extend_signup_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for additional validation of existing and additional form elements, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_validate_extend_signup_form($data) {&lt;br /&gt;
   // Validate that an injected elements equals the word &#039;test&#039;&lt;br /&gt;
  $errors = array();&lt;br /&gt;
  if ($data[&#039;injectedtext&#039;] != &#039;test&#039;) {&lt;br /&gt;
      $errors[&#039;injectedtext&#039;] = &#039;wrong&#039;;&lt;br /&gt;
  }&lt;br /&gt;
  return $errors;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== post_change_password_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: Fire any additional actions required after a user changes their password. This function is passed the submitted form data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_post_change_password_requests($data) {&lt;br /&gt;
   // Display a popup message that echoes what a user submitted in an injected element&lt;br /&gt;
   $message = (&#039;post_change_password_request - Input: &#039;.$data-&amp;gt;injectedtext);&lt;br /&gt;
   echo &amp;quot;&amp;lt;script type=&#039;text/javascript&#039;&amp;gt;alert(&#039;$message&#039;);&amp;lt;/script&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== post_set_password_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: Fire any additional actions required after a user resets their password. This function is passed the submitted form data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_post_set_password_requests($data) {&lt;br /&gt;
   // Display a popup message that echoes what a user submitted in an injected element&lt;br /&gt;
   $message = (&#039;post_set_password_request - Input: &#039;.$data-&amp;gt;injectedtext);&lt;br /&gt;
   echo &amp;quot;&amp;lt;script type=&#039;text/javascript&#039;&amp;gt;alert(&#039;$message&#039;);&amp;lt;/script&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== post_forgot_password_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: Fire any additional actions required after a user submits a password reset request. This function is passed the submitted form data.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_post_forgot_password_requests($data) {&lt;br /&gt;
   // Display a popup message that echoes what a user submitted in an injected element&lt;br /&gt;
   $message = (&#039;post_forgot_password_request - Input: &#039;.$data-&amp;gt;injectedtext);&lt;br /&gt;
   echo &amp;quot;&amp;lt;script type=&#039;text/javascript&#039;&amp;gt;alert(&#039;$message&#039;);&amp;lt;/script&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== post_signup_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: Fire any additional actions required after a user creates an account. This function is passed the submitted form data.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_post_signup_requests($data) {&lt;br /&gt;
   // Display a popup message that echoes what a user submitted in an injected element&lt;br /&gt;
   $message = (&#039;post_signup_request - Input: &#039;.$data-&amp;gt;injectedtext);&lt;br /&gt;
   echo &amp;quot;&amp;lt;script type=&#039;text/javascript&#039;&amp;gt;alert(&#039;$message&#039;);&amp;lt;/script&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;/div&gt;</summary>
		<author><name>Peterburnett</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Login_callbacks&amp;diff=56540</id>
		<title>Login callbacks</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Login_callbacks&amp;diff=56540"/>
		<updated>2019-10-15T04:28:19Z</updated>

		<summary type="html">&lt;p&gt;Peterburnett: /* post_change_password_requests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are cases where we want any plugin to do some check or action as part of the require_login check or related things around logging in or passwords but which are not handled by an authentication plugin.&lt;br /&gt;
&lt;br /&gt;
== after_require_login ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.7}}&lt;br /&gt;
&lt;br /&gt;
This callback allow a plugin to add additional behavior after require_login is called. Some use cases:&lt;br /&gt;
&lt;br /&gt;
* replacing the sitepolicy feature with a more robust / advanced version&lt;br /&gt;
* augmenting the &#039;user fully setup&#039; workflow to add more steps but outside their profile editing page&lt;br /&gt;
* adding extra layers of checks, eg an ip address check but doing this across whole courses instead of at the sitelevel which is too coarse, or at the activity level which is too fine.&lt;br /&gt;
* enforcing various types of course visibility dependencies, eg &#039;before you can do course X you need to complete course Y&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_after_require_login() {&lt;br /&gt;
    if (should_divert()) {&lt;br /&gt;
        redirect($somewhere);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Implemented in https://tracker.moodle.org/browse/MDL-60470&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== check_password_policy ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.6}}&lt;br /&gt;
&lt;br /&gt;
This callback allows a plugin to add additional password tests.&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-61694&lt;br /&gt;
&lt;br /&gt;
== print_password_policy ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
This callback allows a plugin to explain the additional password added via check_password_policy&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66278&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== pre_signup_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.5}}&lt;br /&gt;
&lt;br /&gt;
eg to do actions before sign up such as acceptance of policies, validations, etc&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_pre_signup_requests() {&lt;br /&gt;
   // Do some special policy&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-61485&lt;br /&gt;
&lt;br /&gt;
== extend_change_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for injection of additional form elements into the change password form, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_extend_change_password_form($mform, $user) {&lt;br /&gt;
   // Inject a static element of the user&#039;s username&lt;br /&gt;
   $mform-&amp;gt;addElement(&#039;static&#039;, &#039;injectedstatic&#039;, $user-&amp;gt;username);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== extend_set_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for injection of additional form elements into the set password form, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_extend_set_password_form($mform, $user) {&lt;br /&gt;
   // Inject a static element of the user&#039;s username&lt;br /&gt;
   $mform-&amp;gt;addElement(&#039;static&#039;, &#039;injectedstatic&#039;, $user-&amp;gt;username);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== extend_forgot_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for injection of additional form elements into the forgot password form, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_extend_forgot_password_form($mform) {&lt;br /&gt;
   // Inject a static element of the word &#039;injected&#039;&lt;br /&gt;
   $mform-&amp;gt;addElement(&#039;static&#039;, &#039;injectedstatic&#039;, &#039;injected&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== extend_signup_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for injection of additional form elements into the forgot password form, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_extend_signup_form($mform) {&lt;br /&gt;
   // Inject a static element of the word &#039;injected&#039;&lt;br /&gt;
   $mform-&amp;gt;addElement(&#039;static&#039;, &#039;injectedstatic&#039;, &#039;injected&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== validate_extend_change_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for additional validation of existing and additional form elements, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_validate_extend_change_password_form($data, $user) {&lt;br /&gt;
   // Validate that an injected elements equals the word &#039;test&#039;&lt;br /&gt;
  $errors = array();&lt;br /&gt;
  if ($data[&#039;injectedtext&#039;] != &#039;test&#039;) {&lt;br /&gt;
      $errors[&#039;injectedtext&#039;] = &#039;wrong&#039;;&lt;br /&gt;
  }&lt;br /&gt;
  return $errors;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== validate_extend_set_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for additional validation of existing and additional form elements, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_validate_extend_set_password_form($data, $user) {&lt;br /&gt;
   // Validate that an injected elements equals the word &#039;test&#039;&lt;br /&gt;
  $errors = array();&lt;br /&gt;
  if ($data[&#039;injectedtext&#039;] != &#039;test&#039;) {&lt;br /&gt;
      $errors[&#039;injectedtext&#039;] = &#039;wrong&#039;;&lt;br /&gt;
  }&lt;br /&gt;
  return $errors;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== validate_extend_forgot_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for additional validation of existing and additional form elements, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_validate_extend_forgot_password_form($data) {&lt;br /&gt;
   // Validate that an injected elements equals the word &#039;test&#039;&lt;br /&gt;
  $errors = array();&lt;br /&gt;
  if ($data[&#039;injectedtext&#039;] != &#039;test&#039;) {&lt;br /&gt;
      $errors[&#039;injectedtext&#039;] = &#039;wrong&#039;;&lt;br /&gt;
  }&lt;br /&gt;
  return $errors;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== validate_extend_signup_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for additional validation of existing and additional form elements, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_validate_extend_signup_form($data) {&lt;br /&gt;
   // Validate that an injected elements equals the word &#039;test&#039;&lt;br /&gt;
  $errors = array();&lt;br /&gt;
  if ($data[&#039;injectedtext&#039;] != &#039;test&#039;) {&lt;br /&gt;
      $errors[&#039;injectedtext&#039;] = &#039;wrong&#039;;&lt;br /&gt;
  }&lt;br /&gt;
  return $errors;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== post_change_password_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: Fire any additional actions required after a user changes their password. This function is passed the submitted form data.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_post_change_password_requests($data) {&lt;br /&gt;
   // Display a popup message that echoes what a user submitted in an injected element&lt;br /&gt;
   $message = (&#039;post_change_password_request - Input: &#039;.$data-&amp;gt;injectedtext);&lt;br /&gt;
   echo &amp;quot;&amp;lt;script type=&#039;text/javascript&#039;&amp;gt;alert(&#039;$message&#039;);&amp;lt;/script&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== post_set_password_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: Fire any additional actions required after a user resets their password. This function is passed the submitted form data.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_post_set_password_requests($data) {&lt;br /&gt;
   // Display a popup message that echoes what a user submitted in an injected element&lt;br /&gt;
   $message = (&#039;post_set_password_request - Input: &#039;.$data-&amp;gt;injectedtext);&lt;br /&gt;
   echo &amp;quot;&amp;lt;script type=&#039;text/javascript&#039;&amp;gt;alert(&#039;$message&#039;);&amp;lt;/script&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== post_forgot_password_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: Fire any additional actions required after a user submits a password reset request. This function is passed the submitted form data.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_post_forgot_password_requests($data) {&lt;br /&gt;
   // Display a popup message that echoes what a user submitted in an injected element&lt;br /&gt;
   $message = (&#039;post_forgot_password_request - Input: &#039;.$data-&amp;gt;injectedtext);&lt;br /&gt;
   echo &amp;quot;&amp;lt;script type=&#039;text/javascript&#039;&amp;gt;alert(&#039;$message&#039;);&amp;lt;/script&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== post_signup_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: Fire any additional actions required after a user creates an account. This function is passed the submitted form data.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_post_signup_requests($data) {&lt;br /&gt;
   // Display a popup message that echoes what a user submitted in an injected element&lt;br /&gt;
   $message = (&#039;post_signup_request - Input: &#039;.$data-&amp;gt;injectedtext);&lt;br /&gt;
   echo &amp;quot;&amp;lt;script type=&#039;text/javascript&#039;&amp;gt;alert(&#039;$message&#039;);&amp;lt;/script&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;/div&gt;</summary>
		<author><name>Peterburnett</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Callbacks&amp;diff=56539</id>
		<title>Callbacks</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Callbacks&amp;diff=56539"/>
		<updated>2019-10-15T04:27:37Z</updated>

		<summary type="html">&lt;p&gt;Peterburnett: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Moodle does not have well-defined Hooks API but still allows plugins to hook into different processes by &#039;&#039;&#039;implementing callbacks&#039;&#039;&#039;. See also [[Communication Between Components]].&lt;br /&gt;
&lt;br /&gt;
Some old APIs that were created before object-oriented programming use only callbacks. One of them is [[Activity modules]].&lt;br /&gt;
&lt;br /&gt;
==Types of callbacks in Moodle==&lt;br /&gt;
&lt;br /&gt;
=== Callback functions one-to-many ===&lt;br /&gt;
&lt;br /&gt;
Core has a &amp;quot;hook point&amp;quot; where it allows plugins to execute some code, modify variables or return a result. Sometimes (especially for old callbacks) only plugins of a specific plugin type are allowed, however this is not recommended for the new callbacks because the list of callbacks is now cached and performance is not a constraint any more. If plugins want to implement the function for this callback they normally must place it in &#039;&#039;&#039;lib.php&#039;&#039;&#039; with the name &#039;&#039;&#039;pluginfullname_callbackname()&#039;&#039;&#039;. Here pluginname should be a full plugin name with a prefix, however activity modules can often omit the &amp;quot;mod_&amp;quot; prefix for historical reasons. Implementing this type of callback is optional and the &amp;quot;hook point&amp;quot; does not care how many and which plugins implement callback. Also &amp;quot;hook point&amp;quot; does not check if the plugin is enabled on this site, inside the callback plugins must check it themselves if it is important. Methods &#039;&#039;&#039;get_plugin_list_with_function()&#039;&#039;&#039; and &#039;&#039;&#039;get_plugins_with_function()&#039;&#039;&#039; are normally used in the &amp;quot;hook points&amp;quot; to find all plugins implementing a callback.&lt;br /&gt;
&lt;br /&gt;
This document aims to cover ALL callbacks of this type that are present in Moodle core APIs or in standard Moodle plugins.&lt;br /&gt;
&lt;br /&gt;
=== Callback functions one-to-one ===&lt;br /&gt;
&lt;br /&gt;
Core API (or plugins such as blocks or reports) looks for and executes a method from the plugin/component that &amp;quot;owns&amp;quot; some entity, usually for checking permissions, pre-processing or providing the human-readable representation of this entity. Similar to one-to-many callbacks, the component/plugin must define a function with the name &#039;&#039;&#039;pluginfullname_callbackname()&#039;&#039;&#039; in lib.php . In some cases the function &#039;&#039;must&#039;&#039; be present or otherwise an exception is thrown or debugging message is displayed. Methods &#039;&#039;&#039;component_callback()&#039;&#039;&#039; and &#039;&#039;&#039;component_callback_exists()&#039;&#039;&#039; are normally used to find an implementation of a callback. Unlike one-to-many callbacks the implementing functions can exist not only in plugins but also in core components.&lt;br /&gt;
&lt;br /&gt;
The list of one-to-one callbacks may not be 100% complete in this document, the aim is to cover the &amp;quot;magic&amp;quot; functions that are actually used despite IDE hints.&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Files in the specific location&#039;&#039;&#039;. Core APIs may look for plugins that have a file with a specific file name, for example &#039;&#039;&#039;version.php&#039;&#039;&#039;, &#039;&#039;&#039;settings.php&#039;&#039;&#039;, &#039;&#039;&#039;styles.css&#039;&#039;&#039;, &#039;&#039;&#039;module.js&#039;&#039;&#039;, files in &#039;&#039;&#039;db/&#039;&#039;&#039; folder, etc. See [[Plugin files]]&lt;br /&gt;
* &#039;&#039;&#039;Event observers&#039;&#039;&#039;. Each plugin can implement event observers that execute code when event is triggered. See [[Event_2#Event_dispatching_and_observers|Events API]] about how to listen to events. Event observers can not always substitute callbacks because they do not return any value and can only happen in case of event. Many &amp;quot;hook points&amp;quot; are necessary before something has happened or when nothing is happening at all, for example a report/summary is gathered. However if it is possible to achieve the desired outcome with event observer, Moodle will not accept requests for adding a &amp;quot;hook point&amp;quot;.&lt;br /&gt;
* Callbacks that are specified in the db/* file, for example in &#039;&#039;&#039;db/service.php&#039;&#039;&#039; developers must specify callback responsible for implementing web service, in &#039;&#039;&#039;db/tags.php&#039;&#039;&#039; developers specify callback for finding tagged items, etc. These types of callbacks are not covered on this page, information about them can be found in the respective APIs.&lt;br /&gt;
&lt;br /&gt;
== Callbacks and external / webservices / consumers (mobile / apps) support ==&lt;br /&gt;
&lt;br /&gt;
=== The problem ===&lt;br /&gt;
&lt;br /&gt;
Our external functions are able to [[Web service API functions|perform a lot of actions]] against core. Those external functions use to implement their functionality reusing [[Core APIs]]. And, those APIs can contain hook points/callbacks to customize Moodle behavior.&lt;br /&gt;
&lt;br /&gt;
Of course, ultimately, those external functions are used by the [[Web_services| web services layer]] providing all the functionality over REST/XMLRCP/SOAP &amp;quot;protocols&amp;quot;. All those &amp;quot;clients&amp;quot; consuming Moodle Webservices (integrations in general, mobile &amp;amp; desktop apps...) should work ok, and we must guarantee that all the code executed in those underlying external functions (that may include hook points/callbacks) is supported by them.&lt;br /&gt;
&lt;br /&gt;
In the other side, some of those callbacks may be focussed entirely in the web version of Moodle and have no application outside from there. Also, sometime, there are callbacks which goal is incompatible with uses from web service consumers, mainly because the consumers don&#039;t support this or that Moodle functionality used by the callback implementations.&lt;br /&gt;
&lt;br /&gt;
Imagine a callback that provides to the consumer with something that it&#039;s not able to manage (say a mustache template, or a moodle form, or any other stuff in general that only core is able to provide). It&#039;s a pretty &amp;quot;possible&amp;quot; case a we need a way to handle it in an organised way.&lt;br /&gt;
&lt;br /&gt;
=== The solution ===&lt;br /&gt;
&lt;br /&gt;
To be able advance with those &amp;quot;problematic&amp;quot; hooks (not being supported by web-service consumers), it has been agreed to proceed with the following points in order to allow them to work via web, avoiding them to impact to consumers and registering the need of introducing (future) viable solutions to enable consumers to work with them.&lt;br /&gt;
&lt;br /&gt;
All the following points must be considered as real requirements in order to allow a new callback (called from externals/web services) to land to core.&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Create a linked MOBILE issue&#039;&#039;&#039; requesting the callback to be supported in the app (for the record and future reference). Clearly explaining which are the externals / web services affected, what should be supported and, ideally, a way to provide that.&lt;br /&gt;
# &#039;&#039;&#039;Clearly indicate in the issue&#039;&#039;&#039; introducing the new callback if the hook is supported or not via WebServices. Callbacks documentation (below in this page) &#039;&#039;&#039;must include the comment&#039;&#039;&#039; &#039;&#039;&amp;quot;Note: This hook is not compatible with the Webservices API or the Moodle mobile app. See MDL-xxxx and MOBILE-xxxx for more info.&amp;quot;&#039;&#039;&amp;quot; (where the MDL and MOBILE issues are the related ones).&lt;br /&gt;
# &#039;&#039;&#039;Add manual tests&#039;&#039;&#039; in the issue for checking that the related functionality in the mobile / desktop app is not broken and everything continues working ok.&lt;br /&gt;
# Check that the &#039;&#039;&#039;modified code or APIs does not impact on the external / WebServices&#039;&#039;&#039; API. You can just check if the modified function is used by the external API just adding a debug message and then running WebServices.&lt;br /&gt;
# If you need to add code in an API already used by the external API, you can always &#039;&#039;&#039;use the WS_SERVER constant&#039;&#039;&#039; to check if the current request comes from the external API to &#039;&#039;&#039;avoid its execution&#039;&#039;&#039;. With links to the correspoinding MDL-xxxx and MOBILE-xxxx issues.&lt;br /&gt;
&lt;br /&gt;
== List of Moodle callbacks ==&lt;br /&gt;
&lt;br /&gt;
=== List of one-to-many callbacks ===&lt;br /&gt;
&lt;br /&gt;
To implement one of these callbacks plugins must add a function &#039;&#039;&#039;pluginfullname_callbackname()&#039;&#039;&#039; in &#039;&#039;&#039;lib.php&#039;&#039;&#039; unless stated otherwise. The &#039;&#039;pluginfullname&#039;&#039; is the name of the plugin with the frankenstyle prefix. For activity modules it is acceptable to omit the &#039;&#039;mod_&#039;&#039; prefix. Refer to the linked documentation or search Moodle code by the callback name to find where it is called, what arguments are supplied and what return value is expected.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Callback&lt;br /&gt;
! Plugin type&lt;br /&gt;
! Version&lt;br /&gt;
! Comments&lt;br /&gt;
|-&lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Navigation, see [[Navigation API]]&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| extend_navigation_course&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| before Moodle 3.0 was only supported by &#039;&#039;report&#039;&#039; and &#039;&#039;tool&#039;&#039; plugin types&lt;br /&gt;
|-&lt;br /&gt;
| extend_settings_navigation&lt;br /&gt;
| local, booktool&lt;br /&gt;
|&lt;br /&gt;
| &#039;&#039;Note, modules have a one-to-one callback with the same name, see below&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| extend_navigation&lt;br /&gt;
| local&lt;br /&gt;
|&lt;br /&gt;
| &#039;&#039;Note, modules have a one-to-one callback with the same name, see below&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| extend_navigation_user_settings&lt;br /&gt;
| *&lt;br /&gt;
| 3.0+&lt;br /&gt;
| before Moodle 3.0 was only supported by &#039;&#039;tool&#039;&#039; plugin types&lt;br /&gt;
|-&lt;br /&gt;
| extend_navigation_category_settings&lt;br /&gt;
| *&lt;br /&gt;
| 3.0+&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| extend_navigation_frontpage&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| extend_navigation_user&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
|&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Before-actions hooks&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| course_module_background_deletion_recommended&lt;br /&gt;
| *&lt;br /&gt;
| 3.2+&lt;br /&gt;
| see [https://github.com/moodle/moodle/blob/MOODLE_32_STABLE/lib/upgrade.txt#L142 upgrade.txt]&lt;br /&gt;
|-&lt;br /&gt;
| pre_block_delete&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| pre_course_category_delete&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| pre_course_delete&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| pre_course_module_delete&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| pre_user_delete&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;[[Login_callbacks]]&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#after_require_login | after_require_login]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.7+&lt;br /&gt;
| eg Add permissions logic across a site or course&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#check_password_policy | check_password_policy]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.6+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#print_password_policy | print_password_policy]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#pre_signup_requests | pre_signup_requests]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.5&lt;br /&gt;
| eg to do actions before sign up such as acceptance of policies, validations, etc&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#extend_change_password_form | extend_change_password_form]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| eg Injecting form elements into the change password form. Note: This hook is not compatible with the Webservices API or the Moodle mobile app. See MDL-66173 and MOBILE-3181 for more info.&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#extend_set_password_form | extend_set_password_form]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| eg Injecting form elements into the set password form. Note: This hook is not compatible with the Webservices API or the Moodle mobile app. See MDL-66173 and MOBILE-3181 for more info.&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#extend_forgot_password_form | extend_forgot_password_form]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| eg Injecting form elements into the forgot password form. Note: This hook is not compatible with the Webservices API or the Moodle mobile app. See MDL-66173 and MOBILE-3181 for more info.&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#extend_signup_form | extend_signup_form]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| eg Injecting form elements into the signup form. Note: This hook is not compatible with the Webservices API or the Moodle mobile app. See MDL-66173 and MOBILE-3181 for more info.&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#validate_extend_change_password_form | validate_extend_change_password_form]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| eg Adding additional validation to the change password form. Note: This hook is not compatible with the Webservices API or the Moodle mobile app. See MDL-66173 and MOBILE-3181 for more info.&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#validate_extend_set_password_form | validate_extend_set_password_form]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| eg Adding additional validation to the set password form. Note: This hook is not compatible with the Webservices API or the Moodle mobile app. See MDL-66173 and MOBILE-3181 for more info.&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#validate_extend_forgot_password_form | validate_extend_forgot_password_form]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| eg Adding additional validation to the forgot password form. Note: This hook is not compatible with the Webservices API or the Moodle mobile app. See MDL-66173 and MOBILE-3181 for more info.&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#validate_extend_signup_form | validate_extend_signup_form]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| eg Adding additional validation to the signup form. Note: This hook is not compatible with the Webservices API or the Moodle mobile app. See MDL-66173 and MOBILE-3181 for more info.&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#post_change_password_requests | post_change_password_requests]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| eg Fire additional actions after a user changes password.&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#post_set_password_requests | post_set_password_requests]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| eg Fire additional actions after a user resets password.&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#post_forgot_password_requests | post_forgot_password_requests]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| eg Fire additional actions after a user submits a password reset request.&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#post_signup_requests | post_signup_requests]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| eg Fire additional actions after a user creates an account.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Page rendering, see [[Output_callbacks]]&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| [[Output_callbacks#add_htmlattributes | add_htmlattributes]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.3+&lt;br /&gt;
| eg Add open graph xml namespace attributes&lt;br /&gt;
|-&lt;br /&gt;
| [[Output_callbacks#before_footer | before_footer]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.3+&lt;br /&gt;
| eg injecting JS across the site, like analytics&lt;br /&gt;
|-&lt;br /&gt;
| [[Output_callbacks#before_http_headers | before_http_headers]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.3+&lt;br /&gt;
| Setting http headers across the site like CSP&lt;br /&gt;
|-&lt;br /&gt;
| [[Output_callbacks#before_standard_html_head | before_standard_html_head]]&lt;br /&gt;
&lt;br /&gt;
| *&lt;br /&gt;
| 3.3+&lt;br /&gt;
| An better API alternative to appending to $CFG-&amp;gt;additionalhtmlhead&lt;br /&gt;
|-&lt;br /&gt;
| [[Output_callbacks#before_standard_top_of_body_html | before_standard_top_of_body_html]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.3+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| [[Output_callbacks#render_navbar_output | render_navbar_output]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.2+&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Course module edit form&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| coursemodule_edit_post_actions&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| coursemodule_standard_elements&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| coursemodule_validation&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Modules&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| check_updates_since&lt;br /&gt;
| mod&lt;br /&gt;
| 3.2+&lt;br /&gt;
| See [[NEWMODULE_Documentation]]&lt;br /&gt;
|-&lt;br /&gt;
| dndupload_register&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Other&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| get_fontawesome_icon_map&lt;br /&gt;
| *&lt;br /&gt;
| 3.3+&lt;br /&gt;
| https://docs.moodle.org/dev/Moodle_icons#Font_awesome_icons&lt;br /&gt;
|-&lt;br /&gt;
| get_question_bank_search_conditions&lt;br /&gt;
| local&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| oauth2_system_scopes&lt;br /&gt;
| *&lt;br /&gt;
| 3.3+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rss_get_feed&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| supports_logstore&lt;br /&gt;
| report&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| get_shortcuts&lt;br /&gt;
| ltisource&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| before_launch&lt;br /&gt;
| ltisource&lt;br /&gt;
| 2.8+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| [[Miscellaneous_callbacks#control_view_profile | control_view_profile]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.6+&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| [[Miscellaneous_callbacks#store_profiling_data | store_profiling_data ]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.6+&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| [[Miscellaneous_callbacks#override_webservice_execution | override_webservice_execution]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.6+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Deprecated&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| cron&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| See [[Task API]]&lt;br /&gt;
|-&lt;br /&gt;
| delete_course&lt;br /&gt;
| mod,report,coursereport,format&lt;br /&gt;
| &lt;br /&gt;
| Replace with observer to course_contents_deleted event&lt;br /&gt;
|-&lt;br /&gt;
| print_overview&lt;br /&gt;
| mod&lt;br /&gt;
| up to 3.2&lt;br /&gt;
| New dashboard uses [[Calendar API]] to populate events on the timeline&lt;br /&gt;
|-&lt;br /&gt;
| report_extend_navigation&lt;br /&gt;
| coursereport&lt;br /&gt;
| &lt;br /&gt;
| Plugin type &#039;&#039;coursereport&#039;&#039; is deprecated, plugin type &#039;&#039;report&#039;&#039; should be used instead&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
if Moodle version is not specified, this means that callback existed for a long time and can be found in all [[Releases|currently supported]] Moodle versions&lt;br /&gt;
&lt;br /&gt;
=== List of one-to-one callbacks ===&lt;br /&gt;
&lt;br /&gt;
To implement one of these callbacks plugins must add a function &#039;&#039;&#039;pluginfullname_callbackname()&#039;&#039;&#039; in &#039;&#039;&#039;lib.php&#039;&#039;&#039; unless stated otherwise. The &#039;&#039;pluginfullname&#039;&#039; is the name of the plugin with the frankenstyle prefix. For activity modules it is acceptable to omit the &#039;&#039;mod_&#039;&#039; prefix. Refer to the linked documentation or search Moodle code by the callback name to find where it is called, what arguments are supplied and what return value is expected.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Callback&lt;br /&gt;
! Plugin type&lt;br /&gt;
! Version&lt;br /&gt;
! Comments&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Comments support&#039;&#039;&#039;, see [[Comment API]]&lt;br /&gt;
|-&lt;br /&gt;
| comment_add&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| comment_display&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| comment_permissions&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| comment_template&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| comment_url&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| comment_validate&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Gradebook&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| export_%_settings_definition&lt;br /&gt;
| gradeexport&lt;br /&gt;
| &lt;br /&gt;
| % is a plugin name &#039;&#039;without&#039;&#039; prefix&lt;br /&gt;
|-&lt;br /&gt;
| import_%_settings_definition&lt;br /&gt;
| gradeimport&lt;br /&gt;
| &lt;br /&gt;
| % is a plugin name &#039;&#039;without&#039;&#039; prefix&lt;br /&gt;
|-&lt;br /&gt;
| report_%_profilereport&lt;br /&gt;
| gradereport&lt;br /&gt;
| &lt;br /&gt;
| % is a plugin name &#039;&#039;without&#039;&#039; prefix&lt;br /&gt;
|-&lt;br /&gt;
| report_%_settings_definition&lt;br /&gt;
| gradereport&lt;br /&gt;
| &lt;br /&gt;
| % is a plugin name &#039;&#039;without&#039;&#039; prefix&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Groups support&#039;&#039;&#039;, see [[Groups API]]&lt;br /&gt;
|-&lt;br /&gt;
| allow_group_member_remove&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| restore_group_member&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| For plugins that create their own groups&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Installation and upgrade&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| xmldb_%_install&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| Located in db/install.php , % refer to the full plugin name, in case of modules without prefix&lt;br /&gt;
|-&lt;br /&gt;
| xmldb_%_install_recovery&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| Located in db/install.php , % refer to the full plugin name, in case of modules without prefix&lt;br /&gt;
|-&lt;br /&gt;
| xmldb_%_uninstall&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| Located in db/uninstall.php , % refer to the full plugin name, in case of modules without prefix&lt;br /&gt;
|-&lt;br /&gt;
| xmldb_%_upgrade&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| Located in db/upgrade.php , % refer to the full plugin name, in case of modules without prefix&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;LTI source&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| add_instance_hook&lt;br /&gt;
| ltisource&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;messagetype&#039;&#039;&lt;br /&gt;
| ltisource&lt;br /&gt;
| &lt;br /&gt;
| Callback name is the type of the message&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Question bank support&#039;&#039;&#039;, see [[Question API]]&lt;br /&gt;
|-&lt;br /&gt;
| question_list_instances&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| question_pluginfile&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| question_preview_pluginfile&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| questions_in_use&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Ratings support&#039;&#039;&#039;, see [[Rating API]]&lt;br /&gt;
|-&lt;br /&gt;
| rating_can_see_item_ratings&lt;br /&gt;
| *&lt;br /&gt;
| 2.9.2+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rating_can_see_item_ratings&lt;br /&gt;
| *&lt;br /&gt;
| 2.9.2+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rating_get_item_fields&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rating_permissions&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rating_validate&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Themes&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $THEME-&amp;gt;csspostprocess&lt;br /&gt;
| theme&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| $THEME-&amp;gt;extralesscallback&lt;br /&gt;
| theme&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| $THEME-&amp;gt;lessvariablescallback&lt;br /&gt;
| theme&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| page_init&lt;br /&gt;
| theme&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Modules: Calendar and dashboard&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| core_calendar_event_action_shows_item_count&lt;br /&gt;
| mod&lt;br /&gt;
| 3.3+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| core_calendar_is_event_visible&lt;br /&gt;
| mod&lt;br /&gt;
| 3.3+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| core_calendar_provide_event_action&lt;br /&gt;
| mod&lt;br /&gt;
| 3.3+&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Modules: Course cache&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| cm_info_dynamic&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| cm_info_view&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| get_coursemodule_info&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Modules: Course reset&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| reset_course_form_defaults&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| reset_course_form_definition&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| reset_userdata&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Modules&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| delete_instance&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| dndupload_handle&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| export_contents&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| Used in WS get_course_contents&lt;br /&gt;
|-&lt;br /&gt;
| extend_settings_navigation&lt;br /&gt;
| mod,booktool&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| extends_navigation&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| get_completion_active_rule_descriptions&lt;br /&gt;
| mod&lt;br /&gt;
| 3.3+&lt;br /&gt;
| Must be present for modules implementing custom completion rules&lt;br /&gt;
|-&lt;br /&gt;
| get_completion_state&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| get_extra_capabilities&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| get_file_areas&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| get_recent_mod_activity&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| get_shortcuts&lt;br /&gt;
| mod&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| grade_item_update&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| grading_areas_list&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| print_recent_activity&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| print_recent_mod_activity&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| refresh_events&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rescale_activity_grades&lt;br /&gt;
| mod&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| scale_used_anywhere&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| update_grades&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| user_complete&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| user_outline&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Glossary formats&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| glossary_print_entry_%&lt;br /&gt;
| for glossary formats&lt;br /&gt;
| &lt;br /&gt;
| Glossary formats is not a plugin type yet, however the list of formats is not hardcoded in the mod_glossary, instead the methods similar to callbacks are used for each subfolder in mod/glossar/format. % refer to the subfolder name, the functions are expected in lib.php&lt;br /&gt;
|-&lt;br /&gt;
| glossary_show_entry_%&lt;br /&gt;
| for glossary formats&lt;br /&gt;
| &lt;br /&gt;
|  - &amp;quot; -&lt;br /&gt;
|-&lt;br /&gt;
| glossary_show_entry_%&lt;br /&gt;
| for glossary formats&lt;br /&gt;
| &lt;br /&gt;
| - &amp;quot; -&lt;br /&gt;
|-&lt;br /&gt;
| glossary_show_entry_%&lt;br /&gt;
| for glossary formats&lt;br /&gt;
| &lt;br /&gt;
| - &amp;quot; -&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Other&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| global_db_replace&lt;br /&gt;
| block&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| inplace_editable&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| See [[Inplace editable]]&lt;br /&gt;
|-&lt;br /&gt;
| output_fragment_*&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| see [[Fragment]]&lt;br /&gt;
|-&lt;br /&gt;
| page_type_list&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| Used when displaying page types in block configuration&lt;br /&gt;
|-&lt;br /&gt;
| params_for_js&lt;br /&gt;
| atto&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| pluginfile&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| Callback checking permissions and preparing the file for serving plugin files, see [[File API]]. Note, in case of &#039;&#039;block&#039;&#039; plugins the list of arguments is slightly different&lt;br /&gt;
|-&lt;br /&gt;
| restore_role_assignment&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| For plugins that create their own role assignments&lt;br /&gt;
|-&lt;br /&gt;
| strings_for_js&lt;br /&gt;
| atto&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| supports&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| Required for activity modules&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Deprecated&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| ajax_section_move&lt;br /&gt;
| format&lt;br /&gt;
| up to 2.3&lt;br /&gt;
| See [[Course formats]]&lt;br /&gt;
|-&lt;br /&gt;
| ajax_support&lt;br /&gt;
| format&lt;br /&gt;
| up to 2.3&lt;br /&gt;
| See [[Course formats]]&lt;br /&gt;
|-&lt;br /&gt;
| delete_course&lt;br /&gt;
| mod&lt;br /&gt;
| up to 3.1&lt;br /&gt;
| use event observer&lt;br /&gt;
|-&lt;br /&gt;
| display_content&lt;br /&gt;
| format&lt;br /&gt;
| up to 2.3&lt;br /&gt;
| See [[Course formats]]&lt;br /&gt;
|-&lt;br /&gt;
| get_post_actions&lt;br /&gt;
| mod,booktool&lt;br /&gt;
| &lt;br /&gt;
| Only called if legacy log is used on the site&lt;br /&gt;
|-&lt;br /&gt;
| get_section_name&lt;br /&gt;
| format&lt;br /&gt;
| up to 2.3&lt;br /&gt;
| See [[Course formats]]&lt;br /&gt;
|-&lt;br /&gt;
| get_section_url&lt;br /&gt;
| format&lt;br /&gt;
| up to 2.3&lt;br /&gt;
| See [[Course formats]]&lt;br /&gt;
|-&lt;br /&gt;
| get_types&lt;br /&gt;
| mod,ltisource&lt;br /&gt;
| up to 3.0&lt;br /&gt;
| Replaced with &#039;&#039;get_shortcuts&#039;&#039; in 3.1&lt;br /&gt;
|-&lt;br /&gt;
| get_view_actions&lt;br /&gt;
| mod,booktool&lt;br /&gt;
| &lt;br /&gt;
| Only called if legacy log is used on the site&lt;br /&gt;
|-&lt;br /&gt;
| load_content&lt;br /&gt;
| format&lt;br /&gt;
| up to 2.3&lt;br /&gt;
| See [[Course formats]]&lt;br /&gt;
|-&lt;br /&gt;
| scale_used&lt;br /&gt;
| mod&lt;br /&gt;
| up to 3.0&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| uses_sections&lt;br /&gt;
| format&lt;br /&gt;
| up to 2.3&lt;br /&gt;
| See [[Course formats]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
if Moodle version is not specified, this means that callback existed for a long time and can be found in all [[Releases|currently supported]] Moodle versions&lt;br /&gt;
&lt;br /&gt;
== Adding new callbacks to core ==&lt;br /&gt;
&lt;br /&gt;
If you are preparing a patch for core which adds a new callback here are some things which should be considered.&lt;br /&gt;
&lt;br /&gt;
TBA see https://tracker.moodle.org/browse/MDL-60510&lt;/div&gt;</summary>
		<author><name>Peterburnett</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Login_callbacks&amp;diff=56500</id>
		<title>Login callbacks</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Login_callbacks&amp;diff=56500"/>
		<updated>2019-10-03T00:56:45Z</updated>

		<summary type="html">&lt;p&gt;Peterburnett: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are cases where we want any plugin to do some check or action as part of the require_login check or related things around logging in or passwords but which are not handled by an authentication plugin.&lt;br /&gt;
&lt;br /&gt;
== after_require_login ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.7}}&lt;br /&gt;
&lt;br /&gt;
This callback allow a plugin to add additional behavior after require_login is called. Some use cases:&lt;br /&gt;
&lt;br /&gt;
* replacing the sitepolicy feature with a more robust / advanced version&lt;br /&gt;
* augmenting the &#039;user fully setup&#039; workflow to add more steps but outside their profile editing page&lt;br /&gt;
* adding extra layers of checks, eg an ip address check but doing this across whole courses instead of at the sitelevel which is too coarse, or at the activity level which is too fine.&lt;br /&gt;
* enforcing various types of course visibility dependencies, eg &#039;before you can do course X you need to complete course Y&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_after_require_login() {&lt;br /&gt;
    if (should_divert()) {&lt;br /&gt;
        redirect($somewhere);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Implemented in https://tracker.moodle.org/browse/MDL-60470&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== check_password_policy ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.6}}&lt;br /&gt;
&lt;br /&gt;
This callback allows a plugin to add additional password tests.&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-61694&lt;br /&gt;
&lt;br /&gt;
== print_password_policy ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
This callback allows a plugin to explain the additional password added via check_password_policy&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66278&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== pre_signup_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.5}}&lt;br /&gt;
&lt;br /&gt;
eg to do actions before sign up such as acceptance of policies, validations, etc&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_pre_signup_requests() {&lt;br /&gt;
   // Do some special policy&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-61485&lt;br /&gt;
&lt;br /&gt;
== extend_change_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for injection of additional form elements into the change password form, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_extend_change_password_form($mform, $user) {&lt;br /&gt;
   // Inject a static element of the user&#039;s username&lt;br /&gt;
   $mform-&amp;gt;addElement(&#039;static&#039;, &#039;injectedstatic&#039;, $user-&amp;gt;username);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== extend_set_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for injection of additional form elements into the set password form, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_extend_set_password_form($mform, $user) {&lt;br /&gt;
   // Inject a static element of the user&#039;s username&lt;br /&gt;
   $mform-&amp;gt;addElement(&#039;static&#039;, &#039;injectedstatic&#039;, $user-&amp;gt;username);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== extend_forgot_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for injection of additional form elements into the forgot password form, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_extend_forgot_password_form($mform) {&lt;br /&gt;
   // Inject a static element of the word &#039;injected&#039;&lt;br /&gt;
   $mform-&amp;gt;addElement(&#039;static&#039;, &#039;injectedstatic&#039;, &#039;injected&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== extend_signup_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for injection of additional form elements into the forgot password form, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_extend_signup_form($mform) {&lt;br /&gt;
   // Inject a static element of the word &#039;injected&#039;&lt;br /&gt;
   $mform-&amp;gt;addElement(&#039;static&#039;, &#039;injectedstatic&#039;, &#039;injected&#039;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== validate_extend_change_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for additional validation of existing and additional form elements, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_validate_extend_change_password_form($data, $user) {&lt;br /&gt;
   // Validate that an injected elements equals the word &#039;test&#039;&lt;br /&gt;
  $errors = array();&lt;br /&gt;
  if ($data[&#039;injectedtext&#039;] != &#039;test&#039;) {&lt;br /&gt;
      $errors[&#039;injectedtext&#039;] = &#039;wrong&#039;;&lt;br /&gt;
  }&lt;br /&gt;
  return $errors;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== validate_extend_set_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for additional validation of existing and additional form elements, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_validate_extend_set_password_form($data, $user) {&lt;br /&gt;
   // Validate that an injected elements equals the word &#039;test&#039;&lt;br /&gt;
  $errors = array();&lt;br /&gt;
  if ($data[&#039;injectedtext&#039;] != &#039;test&#039;) {&lt;br /&gt;
      $errors[&#039;injectedtext&#039;] = &#039;wrong&#039;;&lt;br /&gt;
  }&lt;br /&gt;
  return $errors;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== validate_extend_forgot_password_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for additional validation of existing and additional form elements, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_validate_extend_forgot_password_form($data) {&lt;br /&gt;
   // Validate that an injected elements equals the word &#039;test&#039;&lt;br /&gt;
  $errors = array();&lt;br /&gt;
  if ($data[&#039;injectedtext&#039;] != &#039;test&#039;) {&lt;br /&gt;
      $errors[&#039;injectedtext&#039;] = &#039;wrong&#039;;&lt;br /&gt;
  }&lt;br /&gt;
  return $errors;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== validate_extend_signup_form ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: This callback allows for additional validation of existing and additional form elements, to allow for more complicated behaviour such as 2FA.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_validate_extend_signup_form($data) {&lt;br /&gt;
   // Validate that an injected elements equals the word &#039;test&#039;&lt;br /&gt;
  $errors = array();&lt;br /&gt;
  if ($data[&#039;injectedtext&#039;] != &#039;test&#039;) {&lt;br /&gt;
      $errors[&#039;injectedtext&#039;] = &#039;wrong&#039;;&lt;br /&gt;
  }&lt;br /&gt;
  return $errors;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== post_change_password_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: Fire any additional actions required after a user changes their password. This function is passed the submitted form data.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_post_change_password_requests($data) {&lt;br /&gt;
   // Display a popup message that echoes what a user submitted in an injected element&lt;br /&gt;
   $message = (&#039;post_change_password_request - Input: &#039;.$data-&amp;gt;injectedtext);&lt;br /&gt;
   echo &amp;quot;&amp;lt;script type=&#039;text/javascript&#039;&amp;gt;alert(&#039;$message&#039;);&amp;lt;/script&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== post_set_password_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: Fire any additional actions required after a user resets their password. This function is passed the submitted form data.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_post_set_password_requests($data) {&lt;br /&gt;
   // Display a popup message that echoes what a user submitted in an injected element&lt;br /&gt;
   $message = (&#039;post_set_password_request - Input: &#039;.$data-&amp;gt;injectedtext);&lt;br /&gt;
   echo &amp;quot;&amp;lt;script type=&#039;text/javascript&#039;&amp;gt;alert(&#039;$message&#039;);&amp;lt;/script&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== post_forgot_password_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: Fire any additional actions required after a user submits a password reset request. This function is passed the submitted form data.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_post_forgot_password_requests($data) {&lt;br /&gt;
   // Display a popup message that echoes what a user submitted in an injected element&lt;br /&gt;
   $message = (&#039;post_forgot_password_request - Input: &#039;.$data-&amp;gt;injectedtext);&lt;br /&gt;
   echo &amp;quot;&amp;lt;script type=&#039;text/javascript&#039;&amp;gt;alert(&#039;$message&#039;);&amp;lt;/script&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;br /&gt;
&lt;br /&gt;
== post_signup_requests ==&lt;br /&gt;
&lt;br /&gt;
{{Moodle 3.8}}&lt;br /&gt;
&lt;br /&gt;
WIP: Fire any additional actions required after a user creates an account. This function is passed the submitted form data.&lt;br /&gt;
Note: This hook is not supported or compatible with the Webservices API or the Moodle mobile app. It does not damage or interrupt any current functionality of the mobile application, however injected form elements and actions will not be executed for mobile users.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
function tool_myplugin_post_signup_requests($data) {&lt;br /&gt;
   // Display a popup message that echoes what a user submitted in an injected element&lt;br /&gt;
   $message = (&#039;post_signup_request - Input: &#039;.$data-&amp;gt;injectedtext);&lt;br /&gt;
   echo &amp;quot;&amp;lt;script type=&#039;text/javascript&#039;&amp;gt;alert(&#039;$message&#039;);&amp;lt;/script&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
https://tracker.moodle.org/browse/MDL-66173&lt;/div&gt;</summary>
		<author><name>Peterburnett</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Callbacks&amp;diff=56499</id>
		<title>Callbacks</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Callbacks&amp;diff=56499"/>
		<updated>2019-10-03T00:14:05Z</updated>

		<summary type="html">&lt;p&gt;Peterburnett: /* List of one-to-many callbacks */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Moodle does not have well-defined Hooks API but still allows plugins to hook into different processes by &#039;&#039;&#039;implementing callbacks&#039;&#039;&#039;. See also [[Communication Between Components]].&lt;br /&gt;
&lt;br /&gt;
Some old APIs that were created before object-oriented programming use only callbacks. One of them is [[Activity modules]].&lt;br /&gt;
&lt;br /&gt;
==Types of callbacks in Moodle==&lt;br /&gt;
&lt;br /&gt;
=== Callback functions one-to-many ===&lt;br /&gt;
&lt;br /&gt;
Core has a &amp;quot;hook point&amp;quot; where it allows plugins to execute some code, modify variables or return a result. Sometimes (especially for old callbacks) only plugins of a specific plugin type are allowed, however this is not recommended for the new callbacks because the list of callbacks is now cached and performance is not a constraint any more. If plugins want to implement the function for this callback they normally must place it in &#039;&#039;&#039;lib.php&#039;&#039;&#039; with the name &#039;&#039;&#039;pluginfullname_callbackname()&#039;&#039;&#039;. Here pluginname should be a full plugin name with a prefix, however activity modules can often omit the &amp;quot;mod_&amp;quot; prefix for historical reasons. Implementing this type of callback is optional and the &amp;quot;hook point&amp;quot; does not care how many and which plugins implement callback. Also &amp;quot;hook point&amp;quot; does not check if the plugin is enabled on this site, inside the callback plugins must check it themselves if it is important. Methods &#039;&#039;&#039;get_plugin_list_with_function()&#039;&#039;&#039; and &#039;&#039;&#039;get_plugins_with_function()&#039;&#039;&#039; are normally used in the &amp;quot;hook points&amp;quot; to find all plugins implementing a callback.&lt;br /&gt;
&lt;br /&gt;
This document aims to cover ALL callbacks of this type that are present in Moodle core APIs or in standard Moodle plugins.&lt;br /&gt;
&lt;br /&gt;
=== Callback functions one-to-one ===&lt;br /&gt;
&lt;br /&gt;
Core API (or plugins such as blocks or reports) looks for and executes a method from the plugin/component that &amp;quot;owns&amp;quot; some entity, usually for checking permissions, pre-processing or providing the human-readable representation of this entity. Similar to one-to-many callbacks, the component/plugin must define a function with the name &#039;&#039;&#039;pluginfullname_callbackname()&#039;&#039;&#039; in lib.php . In some cases the function &#039;&#039;must&#039;&#039; be present or otherwise an exception is thrown or debugging message is displayed. Methods &#039;&#039;&#039;component_callback()&#039;&#039;&#039; and &#039;&#039;&#039;component_callback_exists()&#039;&#039;&#039; are normally used to find an implementation of a callback. Unlike one-to-many callbacks the implementing functions can exist not only in plugins but also in core components.&lt;br /&gt;
&lt;br /&gt;
The list of one-to-one callbacks may not be 100% complete in this document, the aim is to cover the &amp;quot;magic&amp;quot; functions that are actually used despite IDE hints.&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Files in the specific location&#039;&#039;&#039;. Core APIs may look for plugins that have a file with a specific file name, for example &#039;&#039;&#039;version.php&#039;&#039;&#039;, &#039;&#039;&#039;settings.php&#039;&#039;&#039;, &#039;&#039;&#039;styles.css&#039;&#039;&#039;, &#039;&#039;&#039;module.js&#039;&#039;&#039;, files in &#039;&#039;&#039;db/&#039;&#039;&#039; folder, etc. See [[Plugin files]]&lt;br /&gt;
* &#039;&#039;&#039;Event observers&#039;&#039;&#039;. Each plugin can implement event observers that execute code when event is triggered. See [[Event_2#Event_dispatching_and_observers|Events API]] about how to listen to events. Event observers can not always substitute callbacks because they do not return any value and can only happen in case of event. Many &amp;quot;hook points&amp;quot; are necessary before something has happened or when nothing is happening at all, for example a report/summary is gathered. However if it is possible to achieve the desired outcome with event observer, Moodle will not accept requests for adding a &amp;quot;hook point&amp;quot;.&lt;br /&gt;
* Callbacks that are specified in the db/* file, for example in &#039;&#039;&#039;db/service.php&#039;&#039;&#039; developers must specify callback responsible for implementing web service, in &#039;&#039;&#039;db/tags.php&#039;&#039;&#039; developers specify callback for finding tagged items, etc. These types of callbacks are not covered on this page, information about them can be found in the respective APIs.&lt;br /&gt;
&lt;br /&gt;
== List of Moodle callbacks ==&lt;br /&gt;
&lt;br /&gt;
=== List of one-to-many callbacks ===&lt;br /&gt;
&lt;br /&gt;
To implement one of these callbacks plugins must add a function &#039;&#039;&#039;pluginfullname_callbackname()&#039;&#039;&#039; in &#039;&#039;&#039;lib.php&#039;&#039;&#039; unless stated otherwise. The &#039;&#039;pluginfullname&#039;&#039; is the name of the plugin with the frankenstyle prefix. For activity modules it is acceptable to omit the &#039;&#039;mod_&#039;&#039; prefix. Refer to the linked documentation or search Moodle code by the callback name to find where it is called, what arguments are supplied and what return value is expected.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Callback&lt;br /&gt;
! Plugin type&lt;br /&gt;
! Version&lt;br /&gt;
! Comments&lt;br /&gt;
|-&lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Navigation, see [[Navigation API]]&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| extend_navigation_course&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| before Moodle 3.0 was only supported by &#039;&#039;report&#039;&#039; and &#039;&#039;tool&#039;&#039; plugin types&lt;br /&gt;
|-&lt;br /&gt;
| extend_settings_navigation&lt;br /&gt;
| local, booktool&lt;br /&gt;
|&lt;br /&gt;
| &#039;&#039;Note, modules have a one-to-one callback with the same name, see below&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| extend_navigation&lt;br /&gt;
| local&lt;br /&gt;
|&lt;br /&gt;
| &#039;&#039;Note, modules have a one-to-one callback with the same name, see below&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| extend_navigation_user_settings&lt;br /&gt;
| *&lt;br /&gt;
| 3.0+&lt;br /&gt;
| before Moodle 3.0 was only supported by &#039;&#039;tool&#039;&#039; plugin types&lt;br /&gt;
|-&lt;br /&gt;
| extend_navigation_category_settings&lt;br /&gt;
| *&lt;br /&gt;
| 3.0+&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| extend_navigation_frontpage&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| extend_navigation_user&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
|&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Before-actions hooks&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| course_module_background_deletion_recommended&lt;br /&gt;
| *&lt;br /&gt;
| 3.2+&lt;br /&gt;
| see [https://github.com/moodle/moodle/blob/MOODLE_32_STABLE/lib/upgrade.txt#L142 upgrade.txt]&lt;br /&gt;
|-&lt;br /&gt;
| pre_block_delete&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| pre_course_category_delete&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| pre_course_delete&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| pre_course_module_delete&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| pre_user_delete&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;[[Login_callbacks]]&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#after_require_login | after_require_login]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.7+&lt;br /&gt;
| eg Add permissions logic across a site or course&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#check_password_policy | check_password_policy]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.6+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#print_password_policy | print_password_policy]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#pre_signup_requests | pre_signup_requests]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.5&lt;br /&gt;
| eg to do actions before sign up such as acceptance of policies, validations, etc&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#extend_change_password_form | extend_change_password_form]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| eg Injecting form elements into the change password form. Note: This hook is not compatible with the Webservices API or the Moodle mobile app.&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#extend_set_password_form | extend_set_password_form]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| eg Injecting form elements into the set password form. Note: This hook is not compatible with the Webservices API or the Moodle mobile app.&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#extend_forgot_password_form | extend_forgot_password_form]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| eg Injecting form elements into the forgot password form. Note: This hook is not compatible with the Webservices API or the Moodle mobile app.&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#extend_signup_form | extend_signup_form]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| eg Injecting form elements into the signup form. Note: This hook is not compatible with the Webservices API or the Moodle mobile app.&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#validate_extend_change_password_form | validate_extend_change_password_form]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| eg Adding additional validation to the change password form. Note: This hook is not compatible with the Webservices API or the Moodle mobile app.&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#validate_extend_set_password_form | validate_extend_set_password_form]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| eg Adding additional validation to the set password form. Note: This hook is not compatible with the Webservices API or the Moodle mobile app.&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#validate_extend_forgot_password_form | validate_extend_forgot_password_form]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| eg Adding additional validation to the forgot password form. Note: This hook is not compatible with the Webservices API or the Moodle mobile app.&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#validate_extend_signup_form | validate_extend_signup_form]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| eg Adding additional validation to the signup form. Note: This hook is not compatible with the Webservices API or the Moodle mobile app.&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#post_change_password_requests | post_change_password_requests]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| eg Fire additional actions after a user changes password. Note: This hook is not compatible with the Webservices API or the Moodle mobile app.&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#post_set_password_requests | post_set_password_requests]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| eg Fire additional actions after a user resets password. Note: This hook is not compatible with the Webservices API or the Moodle mobile app.&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#post_forgot_password_requests | post_forgot_password_requests]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| eg Fire additional actions after a user submits a password reset request. Note: This hook is not compatible with the Webservices API or the Moodle mobile app.&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#post_signup_requests | post_signup_requests]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.8+ (WIP)&lt;br /&gt;
| eg Fire additional actions after a user creates an account. Note: This hook is not compatible with the Webservices API or the Moodle mobile app.&lt;br /&gt;
|-&lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Page rendering, see [[Output_callbacks]]&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| [[Output_callbacks#add_htmlattributes | add_htmlattributes]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.3+&lt;br /&gt;
| eg Add open graph xml namespace attributes&lt;br /&gt;
|-&lt;br /&gt;
| [[Output_callbacks#before_footer | before_footer]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.3+&lt;br /&gt;
| eg injecting JS across the site, like analytics&lt;br /&gt;
|-&lt;br /&gt;
| [[Output_callbacks#before_http_headers | before_http_headers]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.3+&lt;br /&gt;
| Setting http headers across the site like CSP&lt;br /&gt;
|-&lt;br /&gt;
| [[Output_callbacks#before_standard_html_head | before_standard_html_head]]&lt;br /&gt;
&lt;br /&gt;
| *&lt;br /&gt;
| 3.3+&lt;br /&gt;
| An better API alternative to appending to $CFG-&amp;gt;additionalhtmlhead&lt;br /&gt;
|-&lt;br /&gt;
| [[Output_callbacks#before_standard_top_of_body_html | before_standard_top_of_body_html]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.3+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| [[Output_callbacks#render_navbar_output | render_navbar_output]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.2+&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Course module edit form&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| coursemodule_edit_post_actions&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| coursemodule_standard_elements&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| coursemodule_validation&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Modules&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| check_updates_since&lt;br /&gt;
| mod&lt;br /&gt;
| 3.2+&lt;br /&gt;
| See [[NEWMODULE_Documentation]]&lt;br /&gt;
|-&lt;br /&gt;
| dndupload_register&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Other&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| get_fontawesome_icon_map&lt;br /&gt;
| *&lt;br /&gt;
| 3.3+&lt;br /&gt;
| https://docs.moodle.org/dev/Moodle_icons#Font_awesome_icons&lt;br /&gt;
|-&lt;br /&gt;
| get_question_bank_search_conditions&lt;br /&gt;
| local&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| oauth2_system_scopes&lt;br /&gt;
| *&lt;br /&gt;
| 3.3+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rss_get_feed&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| supports_logstore&lt;br /&gt;
| report&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| get_shortcuts&lt;br /&gt;
| ltisource&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| before_launch&lt;br /&gt;
| ltisource&lt;br /&gt;
| 2.8+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| [[Miscellaneous_callbacks#control_view_profile | control_view_profile]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.6+&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| [[Miscellaneous_callbacks#store_profiling_data | store_profiling_data ]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.6+&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| [[Miscellaneous_callbacks#override_webservice_execution | override_webservice_execution]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.6+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Deprecated&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| cron&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| See [[Task API]]&lt;br /&gt;
|-&lt;br /&gt;
| delete_course&lt;br /&gt;
| mod,report,coursereport,format&lt;br /&gt;
| &lt;br /&gt;
| Replace with observer to course_contents_deleted event&lt;br /&gt;
|-&lt;br /&gt;
| print_overview&lt;br /&gt;
| mod&lt;br /&gt;
| up to 3.2&lt;br /&gt;
| New dashboard uses [[Calendar API]] to populate events on the timeline&lt;br /&gt;
|-&lt;br /&gt;
| report_extend_navigation&lt;br /&gt;
| coursereport&lt;br /&gt;
| &lt;br /&gt;
| Plugin type &#039;&#039;coursereport&#039;&#039; is deprecated, plugin type &#039;&#039;report&#039;&#039; should be used instead&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
if Moodle version is not specified, this means that callback existed for a long time and can be found in all [[Releases|currently supported]] Moodle versions&lt;br /&gt;
&lt;br /&gt;
=== List of one-to-one callbacks ===&lt;br /&gt;
&lt;br /&gt;
To implement one of these callbacks plugins must add a function &#039;&#039;&#039;pluginfullname_callbackname()&#039;&#039;&#039; in &#039;&#039;&#039;lib.php&#039;&#039;&#039; unless stated otherwise. The &#039;&#039;pluginfullname&#039;&#039; is the name of the plugin with the frankenstyle prefix. For activity modules it is acceptable to omit the &#039;&#039;mod_&#039;&#039; prefix. Refer to the linked documentation or search Moodle code by the callback name to find where it is called, what arguments are supplied and what return value is expected.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Callback&lt;br /&gt;
! Plugin type&lt;br /&gt;
! Version&lt;br /&gt;
! Comments&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Comments support&#039;&#039;&#039;, see [[Comment API]]&lt;br /&gt;
|-&lt;br /&gt;
| comment_add&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| comment_display&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| comment_permissions&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| comment_template&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| comment_url&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| comment_validate&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Gradebook&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| export_%_settings_definition&lt;br /&gt;
| gradeexport&lt;br /&gt;
| &lt;br /&gt;
| % is a plugin name &#039;&#039;without&#039;&#039; prefix&lt;br /&gt;
|-&lt;br /&gt;
| import_%_settings_definition&lt;br /&gt;
| gradeimport&lt;br /&gt;
| &lt;br /&gt;
| % is a plugin name &#039;&#039;without&#039;&#039; prefix&lt;br /&gt;
|-&lt;br /&gt;
| report_%_profilereport&lt;br /&gt;
| gradereport&lt;br /&gt;
| &lt;br /&gt;
| % is a plugin name &#039;&#039;without&#039;&#039; prefix&lt;br /&gt;
|-&lt;br /&gt;
| report_%_settings_definition&lt;br /&gt;
| gradereport&lt;br /&gt;
| &lt;br /&gt;
| % is a plugin name &#039;&#039;without&#039;&#039; prefix&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Groups support&#039;&#039;&#039;, see [[Groups API]]&lt;br /&gt;
|-&lt;br /&gt;
| allow_group_member_remove&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| restore_group_member&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| For plugins that create their own groups&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Installation and upgrade&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| xmldb_%_install&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| Located in db/install.php , % refer to the full plugin name, in case of modules without prefix&lt;br /&gt;
|-&lt;br /&gt;
| xmldb_%_install_recovery&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| Located in db/install.php , % refer to the full plugin name, in case of modules without prefix&lt;br /&gt;
|-&lt;br /&gt;
| xmldb_%_uninstall&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| Located in db/uninstall.php , % refer to the full plugin name, in case of modules without prefix&lt;br /&gt;
|-&lt;br /&gt;
| xmldb_%_upgrade&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| Located in db/upgrade.php , % refer to the full plugin name, in case of modules without prefix&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;LTI source&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| add_instance_hook&lt;br /&gt;
| ltisource&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;messagetype&#039;&#039;&lt;br /&gt;
| ltisource&lt;br /&gt;
| &lt;br /&gt;
| Callback name is the type of the message&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Question bank support&#039;&#039;&#039;, see [[Question API]]&lt;br /&gt;
|-&lt;br /&gt;
| question_list_instances&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| question_pluginfile&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| question_preview_pluginfile&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| questions_in_use&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Ratings support&#039;&#039;&#039;, see [[Rating API]]&lt;br /&gt;
|-&lt;br /&gt;
| rating_can_see_item_ratings&lt;br /&gt;
| *&lt;br /&gt;
| 2.9.2+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rating_can_see_item_ratings&lt;br /&gt;
| *&lt;br /&gt;
| 2.9.2+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rating_get_item_fields&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rating_permissions&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rating_validate&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Themes&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $THEME-&amp;gt;csspostprocess&lt;br /&gt;
| theme&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| $THEME-&amp;gt;extralesscallback&lt;br /&gt;
| theme&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| $THEME-&amp;gt;lessvariablescallback&lt;br /&gt;
| theme&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| page_init&lt;br /&gt;
| theme&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Modules: Calendar and dashboard&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| core_calendar_event_action_shows_item_count&lt;br /&gt;
| mod&lt;br /&gt;
| 3.3+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| core_calendar_is_event_visible&lt;br /&gt;
| mod&lt;br /&gt;
| 3.3+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| core_calendar_provide_event_action&lt;br /&gt;
| mod&lt;br /&gt;
| 3.3+&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Modules: Course cache&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| cm_info_dynamic&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| cm_info_view&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| get_coursemodule_info&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Modules: Course reset&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| reset_course_form_defaults&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| reset_course_form_definition&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| reset_userdata&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Modules&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| delete_instance&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| dndupload_handle&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| export_contents&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| Used in WS get_course_contents&lt;br /&gt;
|-&lt;br /&gt;
| extend_settings_navigation&lt;br /&gt;
| mod,booktool&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| extends_navigation&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| get_completion_active_rule_descriptions&lt;br /&gt;
| mod&lt;br /&gt;
| 3.3+&lt;br /&gt;
| Must be present for modules implementing custom completion rules&lt;br /&gt;
|-&lt;br /&gt;
| get_completion_state&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| get_extra_capabilities&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| get_file_areas&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| get_recent_mod_activity&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| get_shortcuts&lt;br /&gt;
| mod&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| grade_item_update&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| grading_areas_list&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| print_recent_activity&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| print_recent_mod_activity&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| refresh_events&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rescale_activity_grades&lt;br /&gt;
| mod&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| scale_used_anywhere&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| update_grades&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| user_complete&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| user_outline&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Glossary formats&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| glossary_print_entry_%&lt;br /&gt;
| for glossary formats&lt;br /&gt;
| &lt;br /&gt;
| Glossary formats is not a plugin type yet, however the list of formats is not hardcoded in the mod_glossary, instead the methods similar to callbacks are used for each subfolder in mod/glossar/format. % refer to the subfolder name, the functions are expected in lib.php&lt;br /&gt;
|-&lt;br /&gt;
| glossary_show_entry_%&lt;br /&gt;
| for glossary formats&lt;br /&gt;
| &lt;br /&gt;
|  - &amp;quot; -&lt;br /&gt;
|-&lt;br /&gt;
| glossary_show_entry_%&lt;br /&gt;
| for glossary formats&lt;br /&gt;
| &lt;br /&gt;
| - &amp;quot; -&lt;br /&gt;
|-&lt;br /&gt;
| glossary_show_entry_%&lt;br /&gt;
| for glossary formats&lt;br /&gt;
| &lt;br /&gt;
| - &amp;quot; -&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Other&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| global_db_replace&lt;br /&gt;
| block&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| inplace_editable&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| See [[Inplace editable]]&lt;br /&gt;
|-&lt;br /&gt;
| output_fragment_*&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| see [[Fragment]]&lt;br /&gt;
|-&lt;br /&gt;
| page_type_list&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| Used when displaying page types in block configuration&lt;br /&gt;
|-&lt;br /&gt;
| params_for_js&lt;br /&gt;
| atto&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| pluginfile&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| Callback checking permissions and preparing the file for serving plugin files, see [[File API]]. Note, in case of &#039;&#039;block&#039;&#039; plugins the list of arguments is slightly different&lt;br /&gt;
|-&lt;br /&gt;
| restore_role_assignment&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| For plugins that create their own role assignments&lt;br /&gt;
|-&lt;br /&gt;
| strings_for_js&lt;br /&gt;
| atto&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| supports&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| Required for activity modules&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Deprecated&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| ajax_section_move&lt;br /&gt;
| format&lt;br /&gt;
| up to 2.3&lt;br /&gt;
| See [[Course formats]]&lt;br /&gt;
|-&lt;br /&gt;
| ajax_support&lt;br /&gt;
| format&lt;br /&gt;
| up to 2.3&lt;br /&gt;
| See [[Course formats]]&lt;br /&gt;
|-&lt;br /&gt;
| delete_course&lt;br /&gt;
| mod&lt;br /&gt;
| up to 3.1&lt;br /&gt;
| use event observer&lt;br /&gt;
|-&lt;br /&gt;
| display_content&lt;br /&gt;
| format&lt;br /&gt;
| up to 2.3&lt;br /&gt;
| See [[Course formats]]&lt;br /&gt;
|-&lt;br /&gt;
| get_post_actions&lt;br /&gt;
| mod,booktool&lt;br /&gt;
| &lt;br /&gt;
| Only called if legacy log is used on the site&lt;br /&gt;
|-&lt;br /&gt;
| get_section_name&lt;br /&gt;
| format&lt;br /&gt;
| up to 2.3&lt;br /&gt;
| See [[Course formats]]&lt;br /&gt;
|-&lt;br /&gt;
| get_section_url&lt;br /&gt;
| format&lt;br /&gt;
| up to 2.3&lt;br /&gt;
| See [[Course formats]]&lt;br /&gt;
|-&lt;br /&gt;
| get_types&lt;br /&gt;
| mod,ltisource&lt;br /&gt;
| up to 3.0&lt;br /&gt;
| Replaced with &#039;&#039;get_shortcuts&#039;&#039; in 3.1&lt;br /&gt;
|-&lt;br /&gt;
| get_view_actions&lt;br /&gt;
| mod,booktool&lt;br /&gt;
| &lt;br /&gt;
| Only called if legacy log is used on the site&lt;br /&gt;
|-&lt;br /&gt;
| load_content&lt;br /&gt;
| format&lt;br /&gt;
| up to 2.3&lt;br /&gt;
| See [[Course formats]]&lt;br /&gt;
|-&lt;br /&gt;
| scale_used&lt;br /&gt;
| mod&lt;br /&gt;
| up to 3.0&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| uses_sections&lt;br /&gt;
| format&lt;br /&gt;
| up to 2.3&lt;br /&gt;
| See [[Course formats]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
if Moodle version is not specified, this means that callback existed for a long time and can be found in all [[Releases|currently supported]] Moodle versions&lt;br /&gt;
&lt;br /&gt;
== Adding new callbacks to core ==&lt;br /&gt;
&lt;br /&gt;
If you are preparing a patch for core which adds a new callback here are some things which should be considered.&lt;br /&gt;
&lt;br /&gt;
TBA see https://tracker.moodle.org/browse/MDL-60510&lt;/div&gt;</summary>
		<author><name>Peterburnett</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Callbacks&amp;diff=56180</id>
		<title>Callbacks</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Callbacks&amp;diff=56180"/>
		<updated>2019-06-26T23:37:44Z</updated>

		<summary type="html">&lt;p&gt;Peterburnett: Added check_password_policy in moodlelib.php, from version 3.6&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Moodle does not have well-defined Hooks API but still allows plugins to hook into different processes by &#039;&#039;&#039;implementing callbacks&#039;&#039;&#039;. See also [[Communication Between Components]].&lt;br /&gt;
&lt;br /&gt;
Some old APIs that were created before object-oriented programming use only callbacks. One of them is [[Activity modules]].&lt;br /&gt;
&lt;br /&gt;
==Types of callbacks in Moodle==&lt;br /&gt;
&lt;br /&gt;
=== Callback functions one-to-many ===&lt;br /&gt;
&lt;br /&gt;
Core has a &amp;quot;hook point&amp;quot; where it allows plugins to execute some code, modify variables or return a result. Sometimes (especially for old callbacks) only plugins of a specific plugin type are allowed, however this is not recommended for the new callbacks because the list of callbacks is now cached and performance is not a constraint any more. If plugins want to implement the function for this callback they normally must place it in &#039;&#039;&#039;lib.php&#039;&#039;&#039; with the name &#039;&#039;&#039;pluginfullname_callbackname()&#039;&#039;&#039;. Here pluginname should be a full plugin name with a prefix, however activity modules can often omit the &amp;quot;mod_&amp;quot; prefix for historical reasons. Implementing this type of callback is optional and the &amp;quot;hook point&amp;quot; does not care how many and which plugins implement callback. Also &amp;quot;hook point&amp;quot; does not check if the plugin is enabled on this site, inside the callback plugins must check it themselves if it is important. Methods &#039;&#039;&#039;get_plugin_list_with_function()&#039;&#039;&#039; and &#039;&#039;&#039;get_plugins_with_function()&#039;&#039;&#039; are normally used in the &amp;quot;hook points&amp;quot; to find all plugins implementing a callback.&lt;br /&gt;
&lt;br /&gt;
This document aims to cover ALL callbacks of this type that are present in Moodle core APIs or in standard Moodle plugins.&lt;br /&gt;
&lt;br /&gt;
=== Callback functions one-to-one ===&lt;br /&gt;
&lt;br /&gt;
Core API (or plugins such as blocks or reports) looks for and executes a method from the plugin/component that &amp;quot;owns&amp;quot; some entity, usually for checking permissions, pre-processing or providing the human-readable representation of this entity. Similar to one-to-many callbacks, the component/plugin must define a function with the name &#039;&#039;&#039;pluginfullname_callbackname()&#039;&#039;&#039; in lib.php . In some cases the function &#039;&#039;must&#039;&#039; be present or otherwise an exception is thrown or debugging message is displayed. Methods &#039;&#039;&#039;component_callback()&#039;&#039;&#039; and &#039;&#039;&#039;component_callback_exists()&#039;&#039;&#039; are normally used to find an implementation of a callback. Unlike one-to-many callbacks the implementing functions can exist not only in plugins but also in core components.&lt;br /&gt;
&lt;br /&gt;
The list of one-to-one callbacks may not be 100% complete in this document, the aim is to cover the &amp;quot;magic&amp;quot; functions that are actually used despite IDE hints.&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Files in the specific location&#039;&#039;&#039;. Core APIs may look for plugins that have a file with a specific file name, for example &#039;&#039;&#039;version.php&#039;&#039;&#039;, &#039;&#039;&#039;settings.php&#039;&#039;&#039;, &#039;&#039;&#039;styles.css&#039;&#039;&#039;, &#039;&#039;&#039;module.js&#039;&#039;&#039;, files in &#039;&#039;&#039;db/&#039;&#039;&#039; folder, etc. See [[Plugin files]]&lt;br /&gt;
* &#039;&#039;&#039;Event observers&#039;&#039;&#039;. Each plugin can implement event observers that execute code when event is triggered. See [[Event_2#Event_dispatching_and_observers|Events API]] about how to listen to events. Event observers can not always substitute callbacks because they do not return any value and can only happen in case of event. Many &amp;quot;hook points&amp;quot; are necessary before something has happened or when nothing is happening at all, for example a report/summary is gathered. However if it is possible to achieve the desired outcome with event observer, Moodle will not accept requests for adding a &amp;quot;hook point&amp;quot;.&lt;br /&gt;
* Callbacks that are specified in the db/* file, for example in &#039;&#039;&#039;db/service.php&#039;&#039;&#039; developers must specify callback responsible for implementing web service, in &#039;&#039;&#039;db/tags.php&#039;&#039;&#039; developers specify callback for finding tagged items, etc. These types of callbacks are not covered on this page, information about them can be found in the respective APIs.&lt;br /&gt;
&lt;br /&gt;
== List of Moodle callbacks ==&lt;br /&gt;
&lt;br /&gt;
=== List of one-to-many callbacks ===&lt;br /&gt;
&lt;br /&gt;
To implement one of these callbacks plugins must add a function &#039;&#039;&#039;pluginfullname_callbackname()&#039;&#039;&#039; in &#039;&#039;&#039;lib.php&#039;&#039;&#039; unless stated otherwise. The &#039;&#039;pluginfullname&#039;&#039; is the name of the plugin with the frankenstyle prefix. For activity modules it is acceptable to omit the &#039;&#039;mod_&#039;&#039; prefix. Refer to the linked documentation or search Moodle code by the callback name to find where it is called, what arguments are supplied and what return value is expected.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Callback&lt;br /&gt;
! Plugin type&lt;br /&gt;
! Version&lt;br /&gt;
! Comments&lt;br /&gt;
|-&lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Navigation, see [[Navigation API]]&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| extend_navigation_course&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| before Moodle 3.0 was only supported by &#039;&#039;report&#039;&#039; and &#039;&#039;tool&#039;&#039; plugin types&lt;br /&gt;
|-&lt;br /&gt;
| extend_settings_navigation&lt;br /&gt;
| local, booktool&lt;br /&gt;
|&lt;br /&gt;
| &#039;&#039;Note, modules have a one-to-one callback with the same name, see below&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| extend_navigation&lt;br /&gt;
| local&lt;br /&gt;
|&lt;br /&gt;
| &#039;&#039;Note, modules have a one-to-one callback with the same name, see below&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| extend_navigation_user_settings&lt;br /&gt;
| *&lt;br /&gt;
| 3.0+&lt;br /&gt;
| before Moodle 3.0 was only supported by &#039;&#039;tool&#039;&#039; plugin types&lt;br /&gt;
|-&lt;br /&gt;
| extend_navigation_category_settings&lt;br /&gt;
| *&lt;br /&gt;
| 3.0+&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| extend_navigation_frontpage&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| extend_navigation_user&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
|&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Before-actions hooks&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| course_module_background_deletion_recommended&lt;br /&gt;
| *&lt;br /&gt;
| 3.2+&lt;br /&gt;
| see [https://github.com/moodle/moodle/blob/MOODLE_32_STABLE/lib/upgrade.txt#L142 upgrade.txt]&lt;br /&gt;
|-&lt;br /&gt;
| pre_block_delete&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| pre_course_category_delete&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| pre_course_delete&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| pre_course_module_delete&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| pre_user_delete&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;[[Login_callbacks]]&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| [[Login_callbacks#after_require_login | after_require_login]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.7+&lt;br /&gt;
| eg Add permissions logic across a site or course&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Page rendering, see [[Output_callbacks]]&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| [[Output_callbacks#add_htmlattributes | add_htmlattributes]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.3+&lt;br /&gt;
| eg Add open graph xml namespace attributes&lt;br /&gt;
|-&lt;br /&gt;
| [[Output_callbacks#before_footer | before_footer]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.3+&lt;br /&gt;
| eg injecting JS across the site, like analytics&lt;br /&gt;
|-&lt;br /&gt;
| [[Output_callbacks#before_http_headers | before_http_headers]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.3+&lt;br /&gt;
| Setting http headers across the site like CSP&lt;br /&gt;
|-&lt;br /&gt;
| [[Output_callbacks#before_standard_html_head | before_standard_html_head]]&lt;br /&gt;
&lt;br /&gt;
| *&lt;br /&gt;
| 3.3+&lt;br /&gt;
| An better API alternative to appending to $CFG-&amp;gt;additionalhtmlhead&lt;br /&gt;
|-&lt;br /&gt;
| [[Output_callbacks#before_standard_top_of_body_html | before_standard_top_of_body_html]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.3+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| [[Output_callbacks#render_navbar_output | render_navbar_output]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.2+&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Course module edit form&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| coursemodule_edit_post_actions&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| coursemodule_standard_elements&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| coursemodule_validation&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Modules&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| check_updates_since&lt;br /&gt;
| mod&lt;br /&gt;
| 3.2+&lt;br /&gt;
| See [[NEWMODULE_Documentation]]&lt;br /&gt;
|-&lt;br /&gt;
| dndupload_register&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Other&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| get_fontawesome_icon_map&lt;br /&gt;
| *&lt;br /&gt;
| 3.3+&lt;br /&gt;
| https://docs.moodle.org/dev/Moodle_icons#Font_awesome_icons&lt;br /&gt;
|-&lt;br /&gt;
| get_question_bank_search_conditions&lt;br /&gt;
| local&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| oauth2_system_scopes&lt;br /&gt;
| *&lt;br /&gt;
| 3.3+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rss_get_feed&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| supports_logstore&lt;br /&gt;
| report&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| get_shortcuts&lt;br /&gt;
| ltisource&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| before_launch&lt;br /&gt;
| ltisource&lt;br /&gt;
| 2.8+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| [[Miscellaneous_callbacks#control_view_profile | control_view_profile]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.6+&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| [[Miscellaneous_callbacks#store_profiling_data | store_profiling_data ]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.6+&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| [[Miscellaneous_callbacks#override_webservice_execution | override_webservice_execution]]&lt;br /&gt;
| *&lt;br /&gt;
| 3.6+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| check_password_policy&lt;br /&gt;
| *&lt;br /&gt;
| 3.6+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Deprecated&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| cron&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| See [[Task API]]&lt;br /&gt;
|-&lt;br /&gt;
| delete_course&lt;br /&gt;
| mod,report,coursereport,format&lt;br /&gt;
| &lt;br /&gt;
| Replace with observer to course_contents_deleted event&lt;br /&gt;
|-&lt;br /&gt;
| print_overview&lt;br /&gt;
| mod&lt;br /&gt;
| up to 3.2&lt;br /&gt;
| New dashboard uses [[Calendar API]] to populate events on the timeline&lt;br /&gt;
|-&lt;br /&gt;
| report_extend_navigation&lt;br /&gt;
| coursereport&lt;br /&gt;
| &lt;br /&gt;
| Plugin type &#039;&#039;coursereport&#039;&#039; is deprecated, plugin type &#039;&#039;report&#039;&#039; should be used instead&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
if Moodle version is not specified, this means that callback existed for a long time and can be found in all [[Releases|currently supported]] Moodle versions&lt;br /&gt;
&lt;br /&gt;
=== List of one-to-one callbacks ===&lt;br /&gt;
&lt;br /&gt;
To implement one of these callbacks plugins must add a function &#039;&#039;&#039;pluginfullname_callbackname()&#039;&#039;&#039; in &#039;&#039;&#039;lib.php&#039;&#039;&#039; unless stated otherwise. The &#039;&#039;pluginfullname&#039;&#039; is the name of the plugin with the frankenstyle prefix. For activity modules it is acceptable to omit the &#039;&#039;mod_&#039;&#039; prefix. Refer to the linked documentation or search Moodle code by the callback name to find where it is called, what arguments are supplied and what return value is expected.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Callback&lt;br /&gt;
! Plugin type&lt;br /&gt;
! Version&lt;br /&gt;
! Comments&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Comments support&#039;&#039;&#039;, see [[Comment API]]&lt;br /&gt;
|-&lt;br /&gt;
| comment_add&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| comment_display&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| comment_permissions&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| comment_template&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| comment_url&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| comment_validate&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Gradebook&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| export_%_settings_definition&lt;br /&gt;
| gradeexport&lt;br /&gt;
| &lt;br /&gt;
| % is a plugin name &#039;&#039;without&#039;&#039; prefix&lt;br /&gt;
|-&lt;br /&gt;
| import_%_settings_definition&lt;br /&gt;
| gradeimport&lt;br /&gt;
| &lt;br /&gt;
| % is a plugin name &#039;&#039;without&#039;&#039; prefix&lt;br /&gt;
|-&lt;br /&gt;
| report_%_profilereport&lt;br /&gt;
| gradereport&lt;br /&gt;
| &lt;br /&gt;
| % is a plugin name &#039;&#039;without&#039;&#039; prefix&lt;br /&gt;
|-&lt;br /&gt;
| report_%_settings_definition&lt;br /&gt;
| gradereport&lt;br /&gt;
| &lt;br /&gt;
| % is a plugin name &#039;&#039;without&#039;&#039; prefix&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Groups support&#039;&#039;&#039;, see [[Groups API]]&lt;br /&gt;
|-&lt;br /&gt;
| allow_group_member_remove&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| restore_group_member&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| For plugins that create their own groups&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Installation and upgrade&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| xmldb_%_install&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| Located in db/install.php , % refer to the full plugin name, in case of modules without prefix&lt;br /&gt;
|-&lt;br /&gt;
| xmldb_%_install_recovery&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| Located in db/install.php , % refer to the full plugin name, in case of modules without prefix&lt;br /&gt;
|-&lt;br /&gt;
| xmldb_%_uninstall&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| Located in db/uninstall.php , % refer to the full plugin name, in case of modules without prefix&lt;br /&gt;
|-&lt;br /&gt;
| xmldb_%_upgrade&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| Located in db/upgrade.php , % refer to the full plugin name, in case of modules without prefix&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;LTI source&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| add_instance_hook&lt;br /&gt;
| ltisource&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;messagetype&#039;&#039;&lt;br /&gt;
| ltisource&lt;br /&gt;
| &lt;br /&gt;
| Callback name is the type of the message&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Question bank support&#039;&#039;&#039;, see [[Question API]]&lt;br /&gt;
|-&lt;br /&gt;
| question_list_instances&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| question_pluginfile&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| question_preview_pluginfile&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| questions_in_use&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Ratings support&#039;&#039;&#039;, see [[Rating API]]&lt;br /&gt;
|-&lt;br /&gt;
| rating_can_see_item_ratings&lt;br /&gt;
| *&lt;br /&gt;
| 2.9.2+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rating_can_see_item_ratings&lt;br /&gt;
| *&lt;br /&gt;
| 2.9.2+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rating_get_item_fields&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rating_permissions&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rating_validate&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Themes&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| $THEME-&amp;gt;csspostprocess&lt;br /&gt;
| theme&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| $THEME-&amp;gt;extralesscallback&lt;br /&gt;
| theme&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| $THEME-&amp;gt;lessvariablescallback&lt;br /&gt;
| theme&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| page_init&lt;br /&gt;
| theme&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Modules: Calendar and dashboard&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| core_calendar_event_action_shows_item_count&lt;br /&gt;
| mod&lt;br /&gt;
| 3.3+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| core_calendar_is_event_visible&lt;br /&gt;
| mod&lt;br /&gt;
| 3.3+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| core_calendar_provide_event_action&lt;br /&gt;
| mod&lt;br /&gt;
| 3.3+&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Modules: Course cache&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| cm_info_dynamic&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| cm_info_view&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| get_coursemodule_info&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Modules: Course reset&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| reset_course_form_defaults&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| reset_course_form_definition&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| reset_userdata&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Modules&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| delete_instance&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| dndupload_handle&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| export_contents&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| Used in WS get_course_contents&lt;br /&gt;
|-&lt;br /&gt;
| extend_settings_navigation&lt;br /&gt;
| mod,booktool&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| extends_navigation&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| get_completion_active_rule_descriptions&lt;br /&gt;
| mod&lt;br /&gt;
| 3.3+&lt;br /&gt;
| Must be present for modules implementing custom completion rules&lt;br /&gt;
|-&lt;br /&gt;
| get_completion_state&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| get_extra_capabilities&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| get_file_areas&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| get_recent_mod_activity&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| get_shortcuts&lt;br /&gt;
| mod&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| grade_item_update&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| grading_areas_list&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| print_recent_activity&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| print_recent_mod_activity&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| refresh_events&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| rescale_activity_grades&lt;br /&gt;
| mod&lt;br /&gt;
| 3.1+&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| scale_used_anywhere&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| update_grades&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| user_complete&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| user_outline&lt;br /&gt;
| mod&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Glossary formats&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| glossary_print_entry_%&lt;br /&gt;
| for glossary formats&lt;br /&gt;
| &lt;br /&gt;
| Glossary formats is not a plugin type yet, however the list of formats is not hardcoded in the mod_glossary, instead the methods similar to callbacks are used for each subfolder in mod/glossar/format. % refer to the subfolder name, the functions are expected in lib.php&lt;br /&gt;
|-&lt;br /&gt;
| glossary_show_entry_%&lt;br /&gt;
| for glossary formats&lt;br /&gt;
| &lt;br /&gt;
|  - &amp;quot; -&lt;br /&gt;
|-&lt;br /&gt;
| glossary_show_entry_%&lt;br /&gt;
| for glossary formats&lt;br /&gt;
| &lt;br /&gt;
| - &amp;quot; -&lt;br /&gt;
|-&lt;br /&gt;
| glossary_show_entry_%&lt;br /&gt;
| for glossary formats&lt;br /&gt;
| &lt;br /&gt;
| - &amp;quot; -&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Other&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| global_db_replace&lt;br /&gt;
| block&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| inplace_editable&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| See [[Inplace editable]]&lt;br /&gt;
|-&lt;br /&gt;
| output_fragment_*&lt;br /&gt;
| *&lt;br /&gt;
| 3.1+&lt;br /&gt;
| see [[Fragment]]&lt;br /&gt;
|-&lt;br /&gt;
| page_type_list&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| Used when displaying page types in block configuration&lt;br /&gt;
|-&lt;br /&gt;
| params_for_js&lt;br /&gt;
| atto&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| pluginfile&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| Callback checking permissions and preparing the file for serving plugin files, see [[File API]]. Note, in case of &#039;&#039;block&#039;&#039; plugins the list of arguments is slightly different&lt;br /&gt;
|-&lt;br /&gt;
| restore_role_assignment&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| For plugins that create their own role assignments&lt;br /&gt;
|-&lt;br /&gt;
| strings_for_js&lt;br /&gt;
| atto&lt;br /&gt;
| &lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| supports&lt;br /&gt;
| *&lt;br /&gt;
| &lt;br /&gt;
| Required for activity modules&lt;br /&gt;
|- &lt;br /&gt;
| colspan=4 align=center | &#039;&#039;&#039;Deprecated&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| ajax_section_move&lt;br /&gt;
| format&lt;br /&gt;
| up to 2.3&lt;br /&gt;
| See [[Course formats]]&lt;br /&gt;
|-&lt;br /&gt;
| ajax_support&lt;br /&gt;
| format&lt;br /&gt;
| up to 2.3&lt;br /&gt;
| See [[Course formats]]&lt;br /&gt;
|-&lt;br /&gt;
| delete_course&lt;br /&gt;
| mod&lt;br /&gt;
| up to 3.1&lt;br /&gt;
| use event observer&lt;br /&gt;
|-&lt;br /&gt;
| display_content&lt;br /&gt;
| format&lt;br /&gt;
| up to 2.3&lt;br /&gt;
| See [[Course formats]]&lt;br /&gt;
|-&lt;br /&gt;
| get_post_actions&lt;br /&gt;
| mod,booktool&lt;br /&gt;
| &lt;br /&gt;
| Only called if legacy log is used on the site&lt;br /&gt;
|-&lt;br /&gt;
| get_section_name&lt;br /&gt;
| format&lt;br /&gt;
| up to 2.3&lt;br /&gt;
| See [[Course formats]]&lt;br /&gt;
|-&lt;br /&gt;
| get_section_url&lt;br /&gt;
| format&lt;br /&gt;
| up to 2.3&lt;br /&gt;
| See [[Course formats]]&lt;br /&gt;
|-&lt;br /&gt;
| get_types&lt;br /&gt;
| mod,ltisource&lt;br /&gt;
| up to 3.0&lt;br /&gt;
| Replaced with &#039;&#039;get_shortcuts&#039;&#039; in 3.1&lt;br /&gt;
|-&lt;br /&gt;
| get_view_actions&lt;br /&gt;
| mod,booktool&lt;br /&gt;
| &lt;br /&gt;
| Only called if legacy log is used on the site&lt;br /&gt;
|-&lt;br /&gt;
| load_content&lt;br /&gt;
| format&lt;br /&gt;
| up to 2.3&lt;br /&gt;
| See [[Course formats]]&lt;br /&gt;
|-&lt;br /&gt;
| scale_used&lt;br /&gt;
| mod&lt;br /&gt;
| up to 3.0&lt;br /&gt;
| &lt;br /&gt;
|-&lt;br /&gt;
| uses_sections&lt;br /&gt;
| format&lt;br /&gt;
| up to 2.3&lt;br /&gt;
| See [[Course formats]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
if Moodle version is not specified, this means that callback existed for a long time and can be found in all [[Releases|currently supported]] Moodle versions&lt;br /&gt;
&lt;br /&gt;
== Adding new callbacks to core ==&lt;br /&gt;
&lt;br /&gt;
If you are preparing a patch for core which adds a new callback here are some things which should be considered.&lt;br /&gt;
&lt;br /&gt;
TBA see https://tracker.moodle.org/browse/MDL-60510&lt;/div&gt;</summary>
		<author><name>Peterburnett</name></author>
	</entry>
</feed>