Browse Source

fix #70: Prevent to unenrol a user with a pending application

SABERES_37_STABLE
Arnaud Trouvé 8 years ago
parent
commit
932773ff7b
  1. 15
      lib.php

15
lib.php

@ -41,7 +41,20 @@ class enrol_apply_plugin extends enrol_plugin {
// Users with unenrol cap may unenrol other users manually.
return true;
}
/**
* Prevent to unenrol an user with a pending application
*
* @param stdClass $instance course enrol instance
* @param stdClass $ue record from user_enrolments table, specifies user
* @return bool
*/
public function allow_unenrol_user(stdClass $instance, stdClass $ue) {
global $DB;
if ($DB->record_exists('enrol_apply_applicationinfo', ['userenrolmentid' => $ue->id])) {
return false;
}
return parent::allow_unenrol_user($instance, $ue);
}
/**
* Returns link to page which may be used to add new instance of enrolment plugin in course.
* Multiple instances supported.

Loading…
Cancel
Save