From a73abacee56f1d54490be1d915d76d85c8e43590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Zendegi?= Date: Thu, 4 Dec 2025 07:00:32 +0100 Subject: [PATCH] MDL-87396 mod_assign: Add availability check to notifications --- public/mod/assign/classes/notification_helper.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/public/mod/assign/classes/notification_helper.php b/public/mod/assign/classes/notification_helper.php index af146198506..35a22cb0383 100644 --- a/public/mod/assign/classes/notification_helper.php +++ b/public/mod/assign/classes/notification_helper.php @@ -352,6 +352,12 @@ class notification_helper { return; } + // Check if the module is visible to the user. + $cm = $assignmentobj->get_course_module(); + if (!\core_availability\info_module::is_user_visible($cm, $userid)) { + return; + } + // Check if the due date still within range. $assignmentobj->update_effective_access($userid); $duedate = $assignmentobj->get_instance($userid)->duedate; @@ -458,6 +464,12 @@ class notification_helper { return; } + // Check if the module is visible to the user. + $cm = $assignmentobj->get_course_module(); + if (!\core_availability\info_module::is_user_visible($cm, $userid)) { + return; + } + // Check if the due date still considered overdue. $assignmentobj->update_effective_access($userid); $duedate = $assignmentobj->get_instance($userid)->duedate;