never repeats more than once in an invocation. Otherwise it's sometimes
possible for role_assign() during the enrolment process to cause loops.
function check_enrolment_plugins(&$user) {
global $CFG;
+ static $inprogress; // To prevent this function being called more than once in an invocation
+
+ if (!empty($inprogress)) {
+ return;
+ }
+
+ $inprogress = true; // Set the flag
+
require_once($CFG->dirroot .'/enrol/enrol.class.php');
if (!($plugins = explode(',', $CFG->enrol_plugins_enabled))) {
}
unset($enrol);
}
+
+ $inprogress = false; // Unset the flag
}