Skip to content

Commit

Permalink
MDL-31410 paypal: fix problem on notifications
Browse files Browse the repository at this point in the history
This commit fixes a PHP warning about using a
unititialised variable and also the problems when
notifications are enabled and there is not yet a
teacher in the course, defaulting to admin for student
notifications and preventing teacher notifications to happen.
  • Loading branch information
stronk7 committed Dec 12, 2013
1 parent d47d52d commit 32a8bcc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions enrol/paypal/ipn.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,15 @@


if (!empty($mailstudents)) {
$a = new stdClass();
$a->coursename = format_string($course->fullname, true, array('context' => $coursecontext));
$a->profileurl = "$CFG->wwwroot/user/view.php?id=$user->id";

$eventdata = new stdClass();
$eventdata->modulename = 'moodle';
$eventdata->component = 'enrol_paypal';
$eventdata->name = 'paypal_enrolment';
$eventdata->userfrom = $teacher;
$eventdata->userfrom = empty($teacher) ? get_admin() : $teacher;
$eventdata->userto = $user;
$eventdata->subject = get_string("enrolmentnew", 'enrol', $shortname);
$eventdata->fullmessage = get_string('welcometocoursetext', '', $a);
Expand All @@ -261,7 +262,7 @@

}

if (!empty($mailteachers)) {
if (!empty($mailteachers) && !empty($teacher)) {
$a->course = format_string($course->fullname, true, array('context' => $coursecontext));
$a->user = fullname($user);

Expand Down

0 comments on commit 32a8bcc

Please sign in to comment.