Commit bfd6727b authored by Ferenc Lengyel's avatar Ferenc Lengyel Committed by Tim Hunt
Browse files

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.
parent a91caeef
......@@ -1483,7 +1483,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) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment