With more time spent digging I found several references to what I am doing, or at least close to it.
Apparently I have to modify the certificat module's lib.php and certificate.php.
certificate.php (I added the Italic sections.)
//Email text
$string['emailstudenttext'] = 'Attached is your certificate for $a->course.';
$string['awarded'] = 'Awarded';
$string['emailteachermail'] = '
$a->student has received their certificate: \'$a->certificate\'
for $a->course.
for $a->Company Name: '$a->CompanyName'
for $a->Company Division: '$a->CompanyDivision
The problem with the above is once I implement that section I get blank pages... every page is blank. I remove the sections and the pages come back. I would guess I have done this wrong.
lib.php (I added the Italic sections)
/************************************************************************
* Alerts teachers by email of received certificates. First checks *
* whether the option to email teachers is set for this certificate. *
************************************************************************/
function certificate_email_teachers($course, $certificate, $certrecord, $cm) {
global $USER, $CFG;
if ($certificate->emailteachers == 0) { // No need to do anything
return;
}
$student = $certrecord->studentname;
$user = get_record('user', 'id', $certrecord->userid);
if ($teachers = certificate_get_teachers($certificate, $user, $course, $cm)) {
$strawarded = get_string('awarded', 'certificate');
foreach ($teachers as $teacher) {
unset($info);
$info->student = $student;
$info->course = format_string($course->fullname,true);
$info->certificate = format_string($certificate->name,true);
$user = get_record('user', 'id', $certrecord->userid);
$info->CompanyName = $user->CompanyName;
$info->CompanyDivision = $user->CompanyDivision;
$info->url = $CFG->wwwroot.'/mod/certificate/report.php?id='.$cm->id;
$from = $student;
$postsubject = $strawarded.': '.$info->student.' -> '.$certificate->name;
$posttext = certificate_email_teachers_text($info);
$posthtml = ($teacher->mailformat == 1) ? certificate_email_teachers_html($info) : '';
@email_to_user($teacher, $from, $postsubject, $posttext, $posthtml); // If it fails, oh well, too bad.
}
}
}
This of course creates no issues.
I will keep hunting but any input would be appreciated.
Thank you.
D