Keeping Managers from receiving assignment submission notification emails

Re: Keeping Managers from receiving assignment submission notification emails

by Matthew Lowe -
Number of replies: 0

I know that this is a very old thread, however, we need to limit who gets email notifications for submissions to only those graders in the same group as the student submitting an assessment (surprised that this still hasn't been addressed (unless I am missing something)).

I have trialled the modification in Peter Klinka's post above to the file moodle/mod/assignment/lib.php according to the instructions and it works perfectly for the Assignment  2.2 module.

 

I have located the equivalent function for the new assignment module: moodle/mod/assign/locallib.php (line 3327 (Moodle 2.4)) and modified the code slightly:

 

<code>

private function get_graders($userid) {
//potential graders
$potentialgraders = get_enrolled_users($this->context, "mod/assign:grade");

$graders = array();
$actual_group_of_assignment = groups_get_activity_group($this->coursemodule,false); // get group of current assignment
if (groups_get_activity_groupmode($this->get_course_module()) == SEPARATEGROUPS) { // Separate groups are being used

if ($groups = groups_get_all_groups($this->get_course()->id, $userid)) { // Try to find all groups

foreach ($groups as $group) {

foreach ($potentialgraders as $grader) {

if ($grader->id == $userid) {

continue; // do not send self

}

if (groups_is_member($group->id, $t->id) and $group->id == $actual_group_of_assignment) {

$graders[$grader->id] = $grader;

}

}

}

} else {
// user not in group, try to find graders without group

...

</code>

 

The only changes that I have made to code above is to change the following line:

$actual_group_of_assignment = groups_get_activity_group($this->cm,false); // get group of current assignment

to

$actual_group_of_assignment = groups_get_activity_group($this->coursemodule,false); // get group of current assignment

replacing the 'cm' to 'coursemodule' to pick up the course module.

The system is not throwing any errors, however, emails are still going to all teachers who are included in any group with the submitting student.

 

Anyone have any ideas on how to get this to work?