public function unenrol_user(stdClass $instance, $userid) {
        global $DB;

        // Get the tool associated with this instance. Note - it may not exist if we have deleted
        // the tool. This is fine because we have already cleaned the 'enrol_lti_users' table.
        if ($tool = $DB->get_record('enrol_lti_tools', array('enrolid' => $instance->id), 'id')) {
            // Need to remove the user from the users table.
            $DB->delete_records('enrol_lti_users', array('userid' => $userid, 'toolid' => $tool->id));
        }

        parent::unenrol_user($instance, $userid);
    }
public function unenrol_user(stdClass $instance, $userid) {
        global $DB;

        // Get the tool associated with this instance. Note - it may not exist if we have deleted
        // the tool. This is fine because we have already cleaned the 'enrol_lti_users' table.
        if ($tool = $DB->get_record('enrol_lti_tools', array('enrolid' => $instance->id), 'id')) {
            // Need to remove the user from the users table.
            $DB->delete_records('enrol_lti_users', array('userid' => $userid, 'toolid' => $tool->id));
        }

        parent::unenrol_user($instance, $userid);
    }
public function unenrol_user ( stdClass $ instance , $ userid ) { global $ DB ; // Get the tool associated with this instance. Note - it may not exist if we have deleted // the tool. This is fine because we have already cleaned the 'enrol_lti_users' table. if ( $ tool = $ DB -> get_record ( 'enrol_lti_tools' , array ( 'enrolid' => $ instance -> id ) , 'id' ) ) { // Need to remove the user from the users table. $ DB -> delete_records ( 'enrol_lti_users' , array ( 'userid' => $ userid , 'toolid' => $ tool -> id ) ) ; } parent :: unenrol_user ( $ instance , $ userid ) ; }
Handles un-enrolling a user.

@param stdClass $instance
@param int $userid
@return void
Handles un - enrolling a user .