From fddf3cfb56b48dcd96beb6dbe6936a7b7ae70622 Mon Sep 17 00:00:00 2001 From: ethem Date: Fri, 22 Sep 2006 13:33:37 +0000 Subject: [PATCH] + Changed deprecated enrol_student() function to enrol_into_course(). + No need extra check: if (!empty($CFG->enrol_mailstudents)): enrol_into_course calls email_welcome_message_to_user() internally. --- enrol/authorize/enrol.php | 44 ++++----------------------------------- 1 file changed, 4 insertions(+), 40 deletions(-) diff --git a/enrol/authorize/enrol.php b/enrol/authorize/enrol.php index a1e4210731..2cc75628ce 100755 --- a/enrol/authorize/enrol.php +++ b/enrol/authorize/enrol.php @@ -201,9 +201,7 @@ class enrolment_plugin_authorize redirect($CFG->wwwroot, get_string("reviewnotify", "enrol_authorize"), '30'); } else { - $timestart = $timenow; - $timeend = $timestart + (3600 * 24); // just enrol for 1 days :) - enrol_student($USER->id, $course->id, $timestart, $timeend, 'manual'); + enrol_into_course($course, $USER, 'manual'); redirect("$CFG->wwwroot/course/view.php?id=$course->id"); } return; @@ -236,24 +234,8 @@ class enrolment_plugin_authorize } // Credit card captured, ENROL student now... - if ($course->enrolperiod) { - $timestart = $timenow; - $timeend = $timestart + $course->enrolperiod; - } else { - $timestart = $timeend = 0; - } - - if (enrol_student($USER->id, $course->id, $timestart, $timeend, 'manual')) { + if (enrol_into_course($course, $USER, 'manual')) { $teacher = get_teacher($course->id); - if (!empty($CFG->enrol_mailstudents)) { - $a = new stdClass; - $a->coursename = "$course->fullname"; - $a->profileurl = "$CFG->wwwroot/user/view.php?id=$USER->id"; - email_to_user($USER, - $teacher, - get_string("enrolmentnew", '', $course->shortname), - get_string('welcometocoursetext', '', $a)); - } if (!empty($CFG->enrol_mailteachers)) { $a = new stdClass; $a->course = "$course->fullname"; @@ -355,31 +337,13 @@ class enrolment_plugin_authorize $SESSION->ccpaid = 1; // security check: don't duplicate payment if ($order->transid == 0) { // TEST MODE - $timestart = $timenow; - $timeend = $timestart + (3600 * 24); // just enrol for 1 days :) - enrol_student($USER->id, $course->id, $timestart, $timeend, 'manual'); + enrol_into_course($course, $USER, 'manual'); redirect("$CFG->wwwroot/course/view.php?id=$course->id"); } // ENROL student now ... - if ($course->enrolperiod) { - $timestart = $timenow; - $timeend = $timestart + $course->enrolperiod; - } else { - $timestart = $timeend = 0; - } - - if (enrol_student($USER->id, $course->id, $timestart, $timeend, 'manual')) { + if (enrol_into_course($course, $USER, 'manual')) { $teacher = get_teacher($course->id); - if (!empty($CFG->enrol_mailstudents)) { - $a = new stdClass; - $a->coursename = "$course->fullname"; - $a->profileurl = "$CFG->wwwroot/user/view.php?id=$USER->id"; - email_to_user($USER, - $teacher, - get_string("enrolmentnew", '', $course->shortname), - get_string('welcometocoursetext', '', $a)); - } if (!empty($CFG->enrol_mailteachers)) { $a = new stdClass; $a->course = "$course->fullname"; -- 2.39.5