From e5cd1282a11573e5a8ff0baabd031859ed74a06e Mon Sep 17 00:00:00 2001 From: Ferenc Lengyel Date: Mon, 14 Sep 2015 13:23:51 +0100 Subject: [PATCH] MDL-51402 quiz: notification emails should respect grouping In the case where teachers do not have the accessallgroups capability, we only send "an attempt has been sumbitted "notification to teachers in the same group as the student who submitted. At the moment this considers all groups in the course. If this particular quiz has a grouping set, then the logic should only consider the groups in that grouping. --- mod/quiz/locallib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/quiz/locallib.php b/mod/quiz/locallib.php index 85da20afdd7..aa1374122e7 100644 --- a/mod/quiz/locallib.php +++ b/mod/quiz/locallib.php @@ -1550,7 +1550,7 @@ function quiz_send_notification_messages($course, $quiz, $attempt, $context, $cm // Check for notifications required. $notifyfields = 'u.id, u.username, u.idnumber, u.email, u.emailstop, u.lang, u.timezone, u.mailformat, u.maildisplay, '; $notifyfields .= get_all_user_name_fields(true, 'u'); - $groups = groups_get_all_groups($course->id, $submitter->id); + $groups = groups_get_all_groups($course->id, $submitter->id, $cm->groupingid); if (is_array($groups) && count($groups) > 0) { $groups = array_keys($groups); } else if (groups_get_activity_groupmode($cm, $course) != NOGROUPS) {