Add expiry date to a certificate

Add expiry date to a certificate

by Andrew Hudson -
Number of replies: 1

Is there a way to add an expiry date to a certificate ( 2 years from date of issue) , I know on previous versions of Moodle we did I cant seem to find a way on the latest version we are using 

Average of ratings: -
In reply to Andrew Hudson

Re: Add expiry date to a certificate

by James Todd -
The closest you want is https://github.com/mdjnelson/moodle-mod_customcert/issues/195. Which requires some dev work and is not currently a part of the project.

I'm using the old certificate plugin still, it hasn't been updated for 5 years but still works.
The expiration date is from when the certificate is issued not the course date, which I'm going to look at shortly.
I've only just noticed after years of using it, as most people get there certificate within a week, one person has just clicked on his after 6 months and pointed it out.

you need to create multiple certificate folders named "expiry1yr" and edit the certificate.php file in it.
here's the code for the certificate.php file to add 1 yr.

$timetoadd = 365 * 24 * 60 * 60; // A year in seconds
$expdate = $certrecord->timecreated + $timetoadd;
certificate_print_text($pdf, $x + 63, $y + 110, '', 'freeserif', '', 14, "Expiration Date: " . date("d F, Y", $expdate));

If anyone else has fixed this please reply