mdjnelson / moodle-mod_customcert

Enables the creation of dynamically generated certificates with complete customisation via the web browser.
https://moodle.org/plugins/mod_customcert
GNU General Public License v3.0
90 stars 158 forks source link

Dates and course fields not appearing on Custom Certificate #489

Open amhoppe opened 2 years ago

amhoppe commented 2 years ago

When creating a custom certificate we need to show the course start and end dates as well as a course field course ID number.

The custom certificates show the dates in the preview but do not display dates when issued to learners. The following fields do not render for learners on their certificates:

Course Start Date Course End Date Course ID number Completion Date

What steps need to be taken to correct the certificates?

snetzler commented 2 years ago

I have the same problem. why is there no response?

jorgehuete commented 2 years ago

Same problem here. I only have the certificate activity in the course with two users enrolled (Teacher and student) Curso-Custom-Certificate-Course

This is the date element configuration: Custom-Certificate-test

In the preview it works fine: Custom-Certificate-test-2

But when it is downloaded from the activity, the user does not matter, it is not displayed: Custom-Certificate-test-3

What must be taken into account so that the date is displayed on the certificate?

Peterburnett commented 2 years ago

Hi everyone,

I just had a dig into this, as I also hit it. This is due to records not existing for the date criteria you have set. EG if you are an admin, and downloading the certificate with a date mode of 'Course completion', you don't actually have a course completion record, so when the date element tries to find one for you, it fails, and thus the element isn't drawn.

The logic that controls each of the modes is here: https://github.com/mdjnelson/moodle-mod_customcert/blob/c3942c3/element/date/classes/element.php#L165

Note that the preview mode of this element always defaults to the current date, which explains the difference between the preview and real mode.