Respect course/user language hierarchy when sending certificates by email #717 #718
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.
This pull request introduces improvements to the certificate emailing process in the
mod_customcert
Moodle module, focusing on robust language selection for emails and PDF generation, enhanced debugging, and code modularization. The changes ensure that the correct language is used for each recipient by following a clear hierarchy (certificate, course, user, site), and apply multilang filtering to all email content. The code is also refactored for maintainability, with dedicated methods for sending emails to different recipient groups and improved error logging.Language selection and email delivery improvements:
email_certificate_task.php
, ensuring emails and generated PDFs use the correct language based on certificate, course, user, or site default, with error logging for each step.Code modularization and maintainability:
email_certificate_task.php
.mod_customcert_force_language_for_certificate
inlib.php
to encapsulate language forcing logic, following Moodle's priority hierarchy.Debugging and versioning:
version.php
to reflect these changes.Core library loading:
lib.php
.