Proposal: Improve Core Quiz Notifications (mod_quiz)

Proposal: Improve Core Quiz Notifications (mod_quiz)

by Andrei AG -
Number of replies: 2

Proposal: Improve Core Quiz Notifications (mod_quiz)

Hi all,

We recently developed a local plugin to enhance the quiz open notifications sent to students, and I’d like to suggest improvements that could be implemented directly in Moodle core to make these notifications more accurate, configurable, and informative — without requiring a custom plugin.
 Current Limitations in Moodle Core

    Notifications go to all users with mod/quiz:attempt:
    This includes teachers, managers, and other non-students — even if they are not the intended audience.

    No role-based filtering:
    Core has no built-in way to restrict notifications to only student roles (e.g., role ID 5).

    Fixed 48-hour notification window:
    Moodle currently hardcodes a 2-day window (DAYSECS * 2) before the quiz opens, with no way to configure it.

    No admin UI for notification settings:
    There is no place in Site Administration where you can configure quiz notification behavior, delay, or targeting.

    No way to customize the email content:
    Administrators or developers cannot add custom HTML or plain text (e.g., exam preparation instructions) to the outgoing notification.

    Group restrictions may not always be respected:
    While availability restrictions exist, it’s unclear whether notifications fully respect group-level access (e.g. "Must match group A").

 Suggested Improvements for Moodle Core

    Add role filtering for quiz reminders
    Let administrators limit notifications to specific role IDs (e.g., students only), avoiding unnecessary messages to staff or lecturers.

    Add a configurable "days before" setting
    Replace or override the current hardcoded 48-hour window with an admin-configurable value (e.g., 3, 7, or 14 days before).

    Respect group access restrictions in reminders
    Ensure the quiz reminder system uses core_availability::filter_user_list() or equivalent to only notify students who truly have access based on group rules or availability conditions.

    Support content injection into the message
    Provide a way for site admins to append HTML or plain text content to reminder emails (such as setup instructions, policies, links).

    Expose developer hooks or override points
    Allow developers to modify or extend the quiz reminder behavior (timing, roles, content) without needing to override core classes like notification_helper.

 Real-World Use Case

We had the following requirements in a real academic environment:

    Notify only students (not teachers or staff)

    Respect group restrictions (e.g., "Must match group A")

    Send the reminder exactly 7 days before the quiz opens

    Include custom HTML instructions in the email:

        "Complete Exam Setup"

        "Install Google Chrome"

        "Room Scan required"

        "Review the Examination Policy"

To achieve this cleanly, we developed a local plugin. But these improvements could greatly benefit all Moodle sites if supported directly in core.

Would love to hear if this is being considered for a future roadmap, or if there’s interest in extending the mod_quiz notification system to make it more robust and flexible.

Average of ratings: -
In reply to Andrei AG

Proposal: Improve Core Quiz Notifications (mod_quiz)

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I disagree with some of the things you describe as limitaions:

  • Only the student role should have mod/quiz:attempt capability. That is the default. The logic of using this capability to decide who gets the message is correct. (If your role setup is different, I recommend you reveiw it.)
  • The content of the message is a language string. Thefore you can customise it using Language customisation.
  • The groups thing was just a bug, and I think it got fixed: MDL-84327.

I think that pretty much only leaves making the time-perion customisable. For me, the issue is not just the 2 days, it is the built in assumption what all quizzes with a close date have an open date. I tried to point out that was a false assumption before this got implemented, but I was ignored.

Average of ratings: Useful (5)
In reply to Tim Hunt

Proposal: Improve Core Quiz Notifications (mod_quiz)

by Andrei AG -
Thanks for the thoughtful response!

You're absolutely right that mod/quiz:attempt is the correct capability to use in principle — but in practice, many institutions (like ours) have custom or extended roles for assistants, delayed students, learning support, etc. Some of those may also inherit that capability.

We’ve since corrected our role config, but having optional role filtering or exclusions could help prevent over-notifying unintended users — especially for large institutions with complex role hierarchies.

As for language customization — yes, for static strings it's great. But our use case required injecting reusable HTML footers with exam prep instructions, policy links, etc., which aren't feasible to manage through the language system alone. A plugin hook or dedicated message property would offer clean extensibility here.

Regarding the group filtering — thank you for confirming MDL-84327 fixed it! We've verified that it's working as expected.
Average of ratings: Useful (1)