Repository navigation
Fix automatic certificate availability checks (#1039) - #1054
Merged
Merged
Conversation
mdjnelson
force-pushed
the
issue-1039-main
branch
from
October 19, 2026 13:17
c34e9ec to
f4321f2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1039.
Problem: The scheduled issuance only checked
cm_info::uservisible, which is also true for users withmoodle/course:ignoreavailabilityrestrictions(admins, managers). Such users enrolled withmod/customcert:receiveissuewere issued and emailed certificates without meeting the activity restrictions.Fix: Also require
cm_info::available, which reflects the real availability conditions regardless of capabilities. Existing capability, suspension and visibility checks are unchanged.Regression tests (
email_certificate_task_test.php): admin and manager with unmet restriction get no issue or email (student, teacher and emailothers); students with unmet restriction are skipped; eligible student/manager/admin with met restriction are issued once with no duplicates on re-run, while suspended, no-capability and unenrolled users are excluded; site home respects availability.Tests run: Moodle 5.3:
email_certificate_task_test.php68 tests, OK (full file run before the final CHANGES.md-only rebase). The new admin/manager and site-home tests fail without the fix. phpcs (moodle standard) clean.