Always send emails from 'noreplyuser' (#165)
This commit is contained in:
parent
a6b180454f
commit
1746ec47dc
2 changed files with 4 additions and 13 deletions
|
@ -73,13 +73,10 @@ class email_certificate_task extends \core\task\scheduled_task {
|
|||
$context = \context::instance_by_id($customcert->contextid);
|
||||
|
||||
// Get the person we are going to send this email on behalf of.
|
||||
// Look through the teachers.
|
||||
if ($teachers = get_enrolled_users($context, 'moodle/course:update')) {
|
||||
$teachers = sort_by_roleassignment_authority($teachers, $context);
|
||||
$userfrom = reset($teachers);
|
||||
} else { // Ok, no teachers, use administrator name.
|
||||
$userfrom = get_admin();
|
||||
}
|
||||
$userfrom = \core_user::get_noreply_user();
|
||||
|
||||
// Store teachers for later.
|
||||
$teachers = get_enrolled_users($context, 'moodle/course:update');
|
||||
|
||||
$courseshortname = format_string($customcert->courseshortname, true, array('context' => $context));
|
||||
$coursefullname = format_string($customcert->coursefullname, true, array('context' => $context));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue