Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* enrol_into_course() doesn't send welcome message unless $course->we…

…lcomemessage is set.

  This is actually good thing, because we can send our welcome message.

* enrol_into_course() added in Moodle(2006091700), so authorize plugin requires this version.
  • Loading branch information...
commit 9c59948e6302852f47b33d71486f513e6d55e357 1 parent 158e545
ethem authored
15 enrol/authorize/enrol.php
View
@@ -234,6 +234,13 @@ function cc_submit($form, $course)
}
// Credit card captured, ENROL student now...
+ if (!empty($CFG->enrol_mailstudents)) {
+ $a = new stdClass;
+ $a->courses = $course->fullname;
+ $a->profileurl = "$CFG->wwwroot/user/view.php?id=$USER->id";
+ $a->paymenturl = "$CFG->wwwroot/enrol/authorize/index.php?user=$USER->id";
+ $course->welcomemessage = get_string('welcometocoursesemail', 'enrol_authorize', $a);
+ }
if (enrol_into_course($course, $USER, 'manual')) {
$teacher = get_teacher($course->id);
if (!empty($CFG->enrol_mailteachers)) {
@@ -342,6 +349,13 @@ function echeck_submit($form, $course)
}
// ENROL student now ...
+ if (!empty($CFG->enrol_mailstudents)) {
+ $a = new stdClass;
+ $a->courses = $course->fullname;
+ $a->profileurl = "$CFG->wwwroot/user/view.php?id=$USER->id";
+ $a->paymenturl = "$CFG->wwwroot/enrol/authorize/index.php?user=$USER->id";
+ $course->welcomemessage = get_string('welcometocoursesemail', 'enrol_authorize', $a);
+ }
if (enrol_into_course($course, $USER, 'manual')) {
$teacher = get_teacher($course->id);
if (!empty($CFG->enrol_mailteachers)) {
@@ -643,7 +657,6 @@ function cron()
}
$user = get_record('user', 'id', $order->userid);
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($user->id) has been enrolled to course($course->id).\n";
if (!empty($CFG->enrol_mailstudents)) {
$sendem[] = $order->id;
20 enrol/authorize/locallib.php
View
@@ -171,11 +171,7 @@ function authorize_print_order_details($orderno)
$table->size = array('30%', '70%');
$table->align = array('right', 'left');
- $sql = "SELECT e.*, c.shortname FROM {$CFG->prefix}enrol_authorize e " .
- "INNER JOIN {$CFG->prefix}course c ON c.id = e.courseid " .
- "WHERE e.id = '$orderno'";
-
- $order = get_record_sql($sql);
+ $order = get_record('enrol_authorize', 'id', $orderno);
if (!$order) {
notice("Order $orderno not found.", "index.php");
return;
@@ -204,7 +200,7 @@ function authorize_print_order_details($orderno)
$table->data[] = array("<b>$authstrs->amount:</b>", "$order->currency $order->amount");
if (empty($cmdcapture) and empty($cmdrefund) and empty($cmdvoid) and empty($cmddelete)) {
$color = authorize_get_status_color($status->status);
- $table->data[] = array("<b>$strs->course:</b>", $order->shortname);
+ $table->data[] = array("<b>$strs->course:</b>", $course->shortname);
$table->data[] = array("<b>$strs->status:</b>", "<font style='color:$color'>" . $authstrs->{$status->status} . "</font>");
if ($order->paymentmethod == AN_METHOD_CC) {
$table->data[] = array("<b>$authstrs->nameoncard:</b>", $order->ccname);
@@ -242,12 +238,19 @@ function authorize_print_order_details($orderno)
else {
if (empty($CFG->an_test)) {
$user = get_record('user', 'id', $order->userid);
+ if (!empty($CFG->enrol_mailstudents)) {
+ $a = new stdClass;
+ $a->courses = $course->fullname;
+ $a->profileurl = "$CFG->wwwroot/user/view.php?id=$user->id";
+ $a->paymenturl = "$CFG->wwwroot/enrol/authorize/index.php?user=$user->id";
+ $course->welcomemessage = get_string('welcometocoursesemail', 'enrol_authorize', $a);
+ }
if (enrol_into_course($course, $user, 'manual')) {
redirect("index.php?order=$orderno");
}
else {
$table->data[] = array("<b><font color=red>$strs->error:</font></b>",
- "Error while trying to enrol ".fullname($user)." in '$order->shortname'");
+ "Error while trying to enrol ".fullname($user)." in '$course->shortname'");
}
}
else {
@@ -305,7 +308,6 @@ function authorize_print_order_details($orderno)
else {
if (!empty($unenrol)) {
role_unassign(0, $order->userid, 0, $coursecontext->id);
- //unenrol_student($order->userid, $order->courseid);
}
redirect("index.php?order=$orderno");
}
@@ -395,7 +397,6 @@ function authorize_print_order_details($orderno)
if (empty($CFG->an_test)) {
if (!empty($unenrol)) {
role_unassign(0, $order->userid, 0, $coursecontext->id);
- //unenrol_student($order->userid, $order->courseid);
}
redirect("index.php?order=$orderno");
}
@@ -430,7 +431,6 @@ function authorize_print_order_details($orderno)
else {
if (!empty($unenrol)) {
role_unassign(0, $order->userid, 0, $coursecontext->id);
- //unenrol_student($order->userid, $order->courseid);
}
delete_records('enrol_authorize', 'id', $orderno);
redirect("index.php");
2  enrol/authorize/version.php
View
@@ -1,6 +1,6 @@
<?php // $Id$
$plugin->version = 2006083100;
-$plugin->requires = 2005072200;
+$plugin->requires = 2006091700;
?>
Please sign in to comment.
Something went wrong with that request. Please try again.