date issued not appearing on certificates

date issued not appearing on certificates

by Verity Web Services -
Number of replies: 15

I have set-up my custom certificate template to print the date issued.

However, the date doesn't appear on the certificate when the certificate is viewed by the student or administrator. It does appear when previewing the certificate on the Reposition elements screen of the Edit certificate template option.

I'm running Moodle version 3.3.2 (Build: 20170911) with Custom Certificate version 3.3 release (Build: 2017050508).

Any idea what I might need to do to remedy this?



Attachment no-date-1.jpg
Attachment no-date-2.jpg
Average of ratings: -
In reply to Verity Web Services

Re: date issued not appearing on certificates

by Mark Nelson -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Thanks for the report and the images, helps me try and debug the issue.

Unfortunately I tried to replicating this with the exact version of the plugin you are using on Moodle 3.3 and could not.

On the page where you download the certificate does it display the date above the 'Download certificate' button (see screenshot) accurately?



Note: The reposition elements page just uses dummy data for some elements (grade, date etc) to display the element so that it can be repositioned - as the user doing the repositioning may not have a grade, or date that can be displayed.


In reply to Mark Nelson

Re: date issued not appearing on certificates

by Verity Web Services -

Yes, the date does appear above the download button and it is accurate.

In reply to Verity Web Services

Re: date issued not appearing on certificates

by Mark Nelson -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Do you have access to your database? If so, can you tell me what the values are in the mdl_customcert_elements table for that particular date element? Specifically the 'data' column.

In reply to Mark Nelson

Re: date issued not appearing on certificates

by Verity Web Services -

Data column shows:

{"dateitem":"-2","dateformat":"1"}

In reply to Verity Web Services

Re: date issued not appearing on certificates

by Mark Nelson -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Ok, so '-2' refers to the completion date, not the date it was issued. Can you re-edit the element and save and see if this value changes to -1?

In reply to Mark Nelson

Re: date issued not appearing on certificates

by Verity Web Services -

Yes, it changes according to the option I choose, i.e., Date Issued = -1, Completion Date = -2

In reply to Verity Web Services

Re: date issued not appearing on certificates

by Mark Nelson -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Ok, I am confused.

You said in your first post "I have set-up my custom certificate template to print the date issued" but when you posted the database details above it was set to -2 which is the completion date. Did changing it to -1 not solve the issue?

In reply to Mark Nelson

Re: date issued not appearing on certificates

by Verity Web Services -

Sorry for the confusion. I think I may have misunderstood your question ... " re-edit the element and save and see if this value changes to -1". I thought you meant to change the template date settings to see if they change the value in the database. After changing the settings multiple times, I see the value in the database has changed accordingly each time but the issue still remains...date not being printed on the certificate...as far as I can tell.

In reply to Verity Web Services

Re: date issued not appearing on certificates

by Mark Nelson -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

The 'dateitem' value was '-2' when you first reported the issue (which was the completion date and not the date the certificate was issued), so if you were to change this to '-1' (the date it was issued which is what you want) then it should be displaying the date correctly.

My question - even with the change does the date still not display?

In reply to Mark Nelson

Re: date issued not appearing on certificates

by Verity Web Services -

Maybe I should try to reinstall the plugin to see if that helps. Perhaps a file got corrupted during FTP or something.

To reinstall, I just download the latest version and upload the files because all of the settings are in the database?

Is that correct or should I look at trying something else?

In reply to Verity Web Services

Re: date issued not appearing on certificates

by Mark Nelson -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hm, if a file got corrupted then I would suspect you would receive a bogus fatal error, it wouldn't silently fail, but you could check your apache error logs to see if something is going on.

I think the problem is happening in the function render() in mod/customcert/elements/date/classes/element.php. It would be interesting to see what the values of $dateitem, $preview and $issue are to see if it is hitting the "if ($dateitem == CUSTOMCERT_DATE_ISSUES) {" condition there. It would tell me right away what was happening as it would explain what path it is taking to choose what date to display.

Another thing you could check would be to that in the customcert_issues table there is a value for the timecreated column for that user and certificate.

In response to your initial question - you could just replace the files, as it won't affect the database, but make sure you, or someone else, hasn't done any custom changes that may be overwritten.

In reply to Mark Nelson

Re: date issued not appearing on certificates

by Verity Web Services -

I don't know how to report to you the values of $dateitem, $preview and $issue.  Would that be a matter of sending you the code from the file or a database entry or something else?

I checked customcert_issues table and there are accurate values for timecreated except they are 2 hours off...probably to do with the server timezone vs Moodle's timezone?

In reply to Mark Nelson

Re: date issued not appearing on certificates

by Verity Web Services -
PS. Are you available for hire to help with this? If so, can we communicate privately about it?
In reply to Verity Web Services

Re: date issued not appearing on certificates

by Mark Nelson -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Sending the code won't help (it's already open source and available ;)). It would be good to see the values of those variables at run-time, ie when the user clicks to download the certificate what are these values equal to. This can be easily done with some PHP knowledge (using print_object()). Do you have anyone in your business who can do this?

Re: Personal help, sorry I am very busy working on issues for the Moodle 3.4 release.