Skip to content

Commit

Permalink
Some courses may not have a teacher - in this case, make the enrolment
Browse files Browse the repository at this point in the history
welcome email "from" the admin
  • Loading branch information
martin committed Aug 12, 2002
1 parent 574ff6f commit a049e1d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion course/enrol.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

if (isguest()) {
add_to_log($course->id, "course", "guest", "view.php?id=$course->id", "$REMOTE_ADDR, $REMOTE_HOST");

} else {
if (! enrol_student_in_course($USER->id, $course->id)) {
error("An error occurred while trying to enrol you.");
Expand All @@ -28,7 +29,10 @@
$a->profileurl = "$CFG->wwwroot/user/view.php?id=$USER->id&course=$course->id";
$message = get_string("welcometocoursetext", "", $a);

email_to_user($USER, get_teacher($course->id), $subject, $message);
if (! $teacher = get_teacher($course->id)) {
$teacher = get_admin();
}
email_to_user($USER, $teacher, $subject, $message);

add_to_log($course->id, "course", "enrol", "view.php?id=$course->id", "$USER->id");
}
Expand Down

0 comments on commit a049e1d

Please sign in to comment.