Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Set student enrolment end date to course enrolment period for external

database enrolments.  (fix MDL-6272)
  • Loading branch information...
commit c83afe4ec24710f7383f7a74216f0a4f5f6008fd 1 parent 8aa18dd
martinlanghoff authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 enrol/database/enrol.php
View
8 enrol/database/enrol.php
@@ -41,7 +41,13 @@ function get_student_courses(&$user) {
if (isset($user->student[$course->id])) { /// We have it already
unset($user->student[$course->id]); /// Remove from old list
} else {
- enrol_student($user->id, $course->id, 0, 0, 'database'); /// Enrol the student
+ if ($course->enrolperiod) {
+ $timestart = time();
+ $timeend = time() + $course->enrolperiod;
+ } else {
+ $timestart = $timeend = 0;
+ }
+ enrol_student($user->id, $course->id, $timestart, $timeend, 'database');
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.