Notification Preferences API digest mode versus legacy email notifications in Moodle 4.0
0 reputation · 22 Jun 2021, 23:44 UTC
0 reputation · 22 Jun 2021, 23:44 UTC
Goal: determine whether the Batch digest mode overrides the legacy ‘Enable email notifications’ checkbox when both are configured for a role.
Uncertainty: the Moodle 4.0 documentation does not specify if the digest setting bypasses the legacy email toggle, and later releases (4.1‑4.2) may have altered this interaction, leaving administrators unsure if disabling the legacy option blocks digest emails.
Administrators seeking clarity must rely on version‑specific testing in a controlled environment to observe actual email delivery when both controls are present.
Questions: Does enabling Batch digest for a role send digest emails to users who have the legacy email notification disabled? Does the legacy checkbox act as a hard override, or is it ignored when digest mode is active? Are there any version‑specific differences between Moodle 4.0 and later releases that change this interaction?
35275 reputation · 23 Jun 2021, 10:54 UTC
In Moodle 4.0, the legacy 'Enable email notifications' checkbox acts as a hard override. If the legacy email notification is disabled for a user or role, the system suppresses the notification entirely, meaning no digest emails will be sent regardless of the Batch digest configuration.
The Notification Preferences API was designed to unify delivery channels, but it maintains backward compatibility by respecting existing user preferences. The interaction typically follows this priority sequence:
While Moodle 4.1 and 4.2 introduced refinements to how background tasks and the cron job process these queues, the fundamental relationship between the master toggle and the digest preference remains consistent. The legacy checkbox continues to serve as the primary opt-in/opt-out mechanism.
To confirm this behavior in a staging environment, use the following process:
php admin/cron.php. Verify that no entry is created in the mdl_notification table.type='digest' appears in the mdl_notification table.Diagnostic Detail: Please specify if you are using any third-party plugins that hook into the legacy email_to_user() function, as these may bypass the Notification Preferences API entirely.
Use comments to ask for clarification. Post a solution as an answer.
35,275 reputation · 23 Jun 2021, 11:21 UTC
Core Moodle 4.0 manages digest settings per message provider rather than through a single global legacy checkbox. The email processor stores an enabled/disabled state and a Batch digest type in user preferences; when the processor is disabled, digest queuing does not occur. Administrators should confirm whether a custom plugin or outdated documentation is introducing a separate “Enable email notifications” toggle, because standard core does not expose a global bypass.
For verification, inspect /message/notificationpreferences.php as a test user to confirm the stored processor state and digest type. Trigger a core event such as forum post or assignment feedback, then run the messaging cron task. Compare the same steps on Moodle 4.0 and a later 4.x release, since 4.1 and 4.2 continued deprecating legacy paths and custom plugins may behave differently.