Skip to content
Browse files

Last commit for enrol_student().

enrol_student($order->userid, $order->courseid, $timestart, $timeend, 'manual')
to
role_assign($role->id, $user->id, 0, $context->id, $timestart, $timeend, 0, 'manual'))
  • Loading branch information...
1 parent fddf3cf commit 33f9bffe903249fd9c78eb581d934d4f7e1aad14 ethem committed Sep 22, 2006
Showing with 6 additions and 2 deletions.
  1. +6 −2 enrol/authorize/enrol.php
View
8 enrol/authorize/enrol.php
@@ -634,14 +634,18 @@ function cron()
$timestart = $timenow;
$timeend = $order->settletime + $order->enrolperiod;
}
- if (enrol_student($order->userid, $order->courseid, $timestart, $timeend, 'manual')) {
+ $user = get_record('user', 'id', $order->userid);
+ $course = get_record('course', 'id', $order->courseid);
+ $role = get_default_course_role($course);
+ $context = get_context_instance(CONTEXT_COURSE, $course->id);
+ if (role_assign($role->id, $user->id, 0, $context->id, $timestart, $timeend, 0, 'manual')) {
+ /// enrol_student($order->userid, $order->courseid, $timestart, $timeend, 'manual');
$this->log .= "User($order->userid) has been enrolled to course($order->courseid).\n";
if (!empty($CFG->enrol_mailstudents)) {
$sendem[] = $order->id;
}
}
else {
- $user = get_record('user', 'id', $order->userid);
$faults .= "Error while trying to enrol ".fullname($user)." in '$order->fullname' \n";
foreach ($order as $okey => $ovalue) {
$faults .= " $okey = $ovalue\n";

0 comments on commit 33f9bff

Please sign in to comment.
Something went wrong with that request. Please try again.