#176 Only get users details who are enrolled within the course
This commit is contained in:
parent
5f80f246cb
commit
ed24576728
1 changed files with 1 additions and 2 deletions
|
@ -71,8 +71,7 @@ class email_certificate_task extends \core\task\scheduled_task {
|
||||||
|
|
||||||
// Get the person we are going to send this email on behalf of.
|
// Get the person we are going to send this email on behalf of.
|
||||||
// Look through the teachers.
|
// Look through the teachers.
|
||||||
if ($teachers = get_users_by_capability($context, 'moodle/course:update', 'u.*', 'u.id ASC',
|
if ($teachers = get_enrolled_users($context, 'moodle/course:update')) {
|
||||||
'', '', '', '', false, true)) {
|
|
||||||
$teachers = sort_by_roleassignment_authority($teachers, $context);
|
$teachers = sort_by_roleassignment_authority($teachers, $context);
|
||||||
$userfrom = reset($teachers);
|
$userfrom = reset($teachers);
|
||||||
} else { // Ok, no teachers, use administrator name.
|
} else { // Ok, no teachers, use administrator name.
|
||||||
|
|
Loading…
Reference in a new issue