Difference between revisions of "Login callbacks"

From MoodleDocs
(Created page with "There are cases where we want any plugin to do some check or action as part of the require_login check. https://tracker.moodle.org/browse/MDL-60470 = after_require_login =...")
 
Line 1: Line 1:
 
There are cases where we want any plugin to do some check or action as part of the require_login check.
 
There are cases where we want any plugin to do some check or action as part of the require_login check.
 
https://tracker.moodle.org/browse/MDL-60470
 
 
  
 
= after_require_login =
 
= after_require_login =
  
Not live yet
+
Not live yet, see https://tracker.moodle.org/browse/MDL-60470
  
 
Some use cases:
 
Some use cases:

Revision as of 01:44, 19 October 2017

There are cases where we want any plugin to do some check or action as part of the require_login check.

after_require_login

Not live yet, see https://tracker.moodle.org/browse/MDL-60470

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);
   }

}