Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Login callbacks: Difference between revisions

From MoodleDocs
No edit summary
No edit summary
Line 38: Line 38:


https://tracker.moodle.org/browse/MDL-66278
https://tracker.moodle.org/browse/MDL-66278
== pre_signup_requests ==
{{Moodle 3.5}}
eg to do actions before sign up such as acceptance of policies, validations, etc
<code>
function tool_myplugin_pre_signup_requests() {
  // Do some special policy
}
</code>
https://tracker.moodle.org/browse/MDL-61485

Revision as of 14:09, 6 August 2019

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.

after_require_login

Moodle 3.7


This callback allow a plugin to add additional behavior after require_login is called. Some use cases:

  • replacing the sitepolicy feature with a more robust / advanced version
  • augmenting the 'user fully setup' workflow to add more steps but outside their profile editing page
  • 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.
  • enforcing various types of course visibility dependencies, eg 'before you can do course X you need to complete course Y'

function tool_myplugin_after_require_login() {

   if (should_divert()) {
       redirect($somewhere);
   }

}

Implemented in https://tracker.moodle.org/browse/MDL-60470


check_password_policy

Moodle 3.6


This callback allows a plugin to add additional password tests.

https://tracker.moodle.org/browse/MDL-61694

print_password_policy

Moodle 3.8


This callback allows a plugin to explain the additional password added via check_password_policy

https://tracker.moodle.org/browse/MDL-66278


pre_signup_requests

Moodle 3.5


eg to do actions before sign up such as acceptance of policies, validations, etc

function tool_myplugin_pre_signup_requests() {

  // Do some special policy

}

https://tracker.moodle.org/browse/MDL-61485