From: moodler <moodler>
Date: Thu, 29 Jul 2004 14:52:07 +0000 (+0000)
Subject: Use enroperiod for new students if it's set
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=9ddc0efd8e2959c71226c3769a611821d5fdca26;p=moodle.git

Use enroperiod for new students if it's set
---

diff --git a/course/student.php b/course/student.php
index 5acea5281a..4442866ff7 100644
--- a/course/student.php
+++ b/course/student.php
@@ -60,7 +60,13 @@
 
     if (!empty($add)) {
         check_for_restricted_user($USER->username, "$CFG->wwwroot/course/student.php?id=$course->id");
-        if (! enrol_student($add, $course->id)) {
+        if ($course->enrolperiod) {
+            $timestart = time();
+            $timeend   = $timestart + $course->enrolperiod;
+        } else {
+            $timestart = $timeend = 0;
+        }
+        if (! enrol_student($add, $course->id, $timestart, $timeend)) {
             error("Could not add that student to this course!");
         }
     }