-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsendemailsessionupdated.php
36 lines (26 loc) · 1.15 KB
/
sendemailsessionupdated.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
require_once 'lib.php';
/* Sends an email to a newly un-registered attendee on a session */
function send_email_sessionupdated($webinar, $session_info, $cm, $date) {
global $CFG;
if ($attendees = webinar_get_attendees($session_info->id)) {
foreach($attendees as $user) {
$a = new stdClass();
$a->name = $user->firstname . " " . $user->lastname;
$a->starttime = date('d F Y h:i A', $date->timestart);
$a->webinarname = $webinar->name;
$a->webinarintro = $webinar->description;
$a->webinaragenda = $webinar->agenda;
$a->sessionurl = $CFG->wwwroot . "/mod/" . $cm->modname . "/view.php?id=" . $cm->id;
$a->adminemail = $webinar->adminemail;
//print_r($a);
$subject = get_string('sessionupdatedsubject', 'webinar', $a);
$contact = get_string('sessionupdatedcontact', 'webinar', $a);
$message = get_string('sessionupdatedmessage', 'webinar', $a);
//last task - strip <p> and </p> from the message before we send the email
$message = str_replace('<p>','',$message);
$message = str_replace('</p>','',$message);
email_to_user($user, $contact, $subject, $message);
}
}
}