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'))
This commit is contained in:
ethem 2006-09-22 13:50:10 +00:00
parent fddf3cfb56
commit 33f9bffe90

View File

@ -634,14 +634,18 @@ class enrolment_plugin_authorize
$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";