mdjnelson/moodle-mod_customcert

Problem with Certificate Generation in Moodle - Date Fields Not Working Properly

Closed this issue · 3 comments

Captura de tela 2024-08-27 154907

I am encountering a problem with the certificate generation process in Moodle. Specifically, while trying to generate certificates using dynamic placeholders for date fields (e.g., {coursestartdate}, {courseenddate}, {completiondate}), these placeholders are not being populated with the actual dates. Instead, only the {DATE} placeholder, which reflects the current date, is working as expected.

The other placeholders return blank values or are not recognized. I need these placeholders to automatically fill with the correct start and end dates of the user's course enrollment, as well as the completion date, in order to accurately reflect the course details in the generated certificate.

Steps to Reproduce:
Set up a certificate template using placeholders like {coursestartdate}, {courseenddate}, {completiondate}.
Issue a certificate to a user who has completed a course.
The generated certificate only shows the current date (using {DATE}), while other date fields remain blank or display as placeholders.
Expected Behavior:
All placeholders related to course start, end, and completion dates should automatically populate with the appropriate dates.
Actual Behavior:
Only {DATE} populates with the current date. The placeholders for start date, end date, and completion date do not populate correctly.
Environment:
Moodle version: [ Moodle latest 4.4.1]
Plugin used for certificates: [custom Certificate]
Additional Information:
This issue affects certificate issuance for users who need accurate course details, impacting the usability and reliability of the certificate module. Any insights or solutions to ensure all date-related placeholders function correctly would be greatly appreciated.
Thank you for your assistance in resolving this issue. If any patches or adjustments can be suggested, I am open to testing them.

Are you able to provide a patch for this?

You are trying to do something that the custom certificate does not and never did support. You can't just put random database table names and columns together hoping they are populated. Either you are using https://moodle.org/plugins/mod_simplecertificate or you don't understand how this plugin works.

I am using the "Simple Certificate" plugin in Moodle to generate course completion certificates. While placeholders like {USERNAME}, {COURSENAME}, and {DATE} are working correctly, I am having trouble with placeholders for the start and end dates of the course. These placeholders do not seem to work, and the dates are not displayed on the certificate as expected.

Could you please provide guidance on how to include the course start and end dates in the certificate using the correct placeholders? Are there specific placeholders supported by the "Simple Certificate" plugin for this purpose?

Any advice or examples would be greatly appreciated.

Thank you for your assistance.

This is the code base for Custom Certificate, not Simple Certificate. Either ask at https://github.com/bozoh/moodle-mod_simplecertificate/, https://moodle.org/plugins/mod_simplecertificate or post on the forums and specify you are using the Simple Certificate, not the Custom Certificate like you said in this issue.