Download previously issued certificates

Download previously issued certificates

by Manieer Chhettri -
Number of replies: 19
I recently needed a plugin to display all previously issued certificates and then being able to let students download them directly without having to go into the courses. This was quite important as our course get archived after certain period so they would not have access to these courses but still needed the ability for them to download the certificates.


I searched this forum and found some information but there was no information or plugin to actually produce direct links to pdf certificates which had been previously issued. So I spent some weeks to get this done for our  site. 


As there were few people wanting this I decided to share it. I am still working to add few more features to the plugin but for now seems to do what I wanted it to do. So do feel free to download, test and implement if found fit for your site. Here's the link to github - 


https://github.com/manieer/moodle-block_report_certificates


Please note that you do need to enable save certificates options for this plugin to work as it looks for all stoted certificates.

Thanks and any suggestions or improvements are welcome. I have submitted the plugin to moodle community  but am waiting for approval.


Average of ratings: Useful (1)
In reply to Manieer Chhettri

Re: Download previously issued certificates

by Manieer Chhettri -

The plugin has now been approved. Hopefully I will get plenty of users feedback to develop this plugin further. Any questions or suggestions please do let me know.


Here's the link to the plugin - https://moodle.org/plugins/view/block_report_certificates

In reply to Manieer Chhettri

Re: Download previously issued certificates

by Alex Ferrer -

Hi Manieer.

As I said yesterday in comments plugin, the block does not work in version 2.8.6+.
I enclose two images with errors.
I hope he can solve easily.

Greetings and thanks.

Alex.


P.D: ignore a line " WHERE cm.module = 4 AND ", is repeated in the 2 images.

Attachment Captura_01.PNG
Attachment Captura_02.PNG
In reply to Alex Ferrer

Re: Download previously issued certificates

by Manieer Chhettri -

Hi there,
I have just updated the codes and tested on my moodle 2.8.3. It works fine now. Had to change the course module and date format. For some reason I had to uninstall my previous install and reinstall the plugin again. I haven't submitted the final code here but wanted to check if it would work for both of you.

Please download the zip from here - https://github.com/manieer/moodle-block_report_certificates/tree/For-Moodle-2.8

You will need to do a manual install of the plugin. Also this plugin is really aimed for the 'My home page' where you can place it on the main content pane.

Please let me know if you encounter any problems.

Thanks,
M

In reply to Manieer Chhettri

Re: Download previously issued certificates

by Tatiana Pereira Filgueiras -

Hi!

I already have Certificate plugin in my moodle and added a certificate, but I still having this message in Dowload Certificates block: "You do not have any certificates issued to you."

What can I do? 

Hugs



In reply to Tatiana Pereira Filgueiras

Re: Download previously issued certificates

by Manieer Chhettri -

Hi Tatiana,

Could you let me know what version of Moodle you are using please? I guess you are using Moodle 2.8 + . Unfortunately I haven't tested it on M2.8 + yet but am planning on doing it.


I am currently testing this on Moodle 2.8 so will release an update soon. But am currently travelling for work so don't have a lot of time but hopefully will release an update in the next two weeks.


Sorry but will definitely try and get an update soon.


Thanks,

M

In reply to Manieer Chhettri

Re: Download previously issued certificates

by Tatiana Pereira Filgueiras -

Hi!

Yes, I'm using 2.9v

Thx for quick reply!

Hugs

Tatiana

In reply to Tatiana Pereira Filgueiras

Re: Download previously issued certificates

by Manieer Chhettri -

Hi there,
I have just updated the codes and tested on my moodle 2.8.3. It works fine now. Had to change the course module and date format. For some reason I had to uninstall my previous install and reinstall the plugin again. I haven't submitted the final code here but wanted to check if it would work for both of you.

Please download the zip from here - https://github.com/manieer/moodle-block_report_certificates/tree/For-Moodle-2.8

You will need to do a manual install of the plugin. Also this plugin is really aimed for the 'My home page' where you can place it on the main content pane.

Please let me know if you encounter any problems.

Thanks,
M

In reply to Manieer Chhettri

Re: Download previously issued certificates

by Luciano Silva -
I'm facing same problem on moodle 2.7, any ideas how fix that?: Debug info: ERROR: column "ci.id" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: SELECT DISTINCT ci.id AS certificateid, ci.userid, ci.code A... ^ SELECT DISTINCT ci.id AS certificateid, ci.userid, ci.code AS code, ci.timecreated AS citimecreated, crt.name AS certificatename, crt.*, cm.id AS coursemoduleid, cm.course, cm.module, c.id AS id, c.fullname AS fullname, c.*, ctx.id AS contextid, ctx.instanceid AS instanceid, f.itemid AS itemid, f.filename AS filename FROM mdl_certificate_issues ci INNER JOIN mdl_certificate crt ON crt.id = ci.certificateid INNER JOIN mdl_course_modules cm ON cm.course = crt.course INNER JOIN mdl_course c ON c.id = cm.course INNER JOIN mdl_context ctx ON ctx.instanceid = cm.id INNER JOIN mdl_files f ON f.contextid = ctx.id WHERE cm.module = 4 AND ctx.contextlevel = 70 AND f.mimetype = 'application/pdf' AND ci.userid = f.userid AND ci.userid = $1 GROUP BY ci.code ORDER BY ci.timecreated ASC LIMIT 5
In reply to Manieer Chhettri

Re: Download previously issued certificates

by Charles McCoy -

Congratulations, nice job on the certificate report. We wanted to ask how or if you could share to add more information to the scope.  We wanted to know if we could add items from the student profile such as location, and the last and first name of the student. And if so it can be download to a excel spreadsheet. 


Thanks for you help in advanced. smile  

In reply to Manieer Chhettri

Re: Download previously issued certificates

by Marius Hammer -

Hi Manieer,

Mark Nelson has now released a new certificate module 'mod_customcert'.
https://moodle.org/plugins/mod_customcert

I don't suppose this block works for this module?

Are there any plans to make a 'Download Certificates' plugin that would work with this new Custom certificate module?




In reply to Manieer Chhettri

Re: Download previously issued certificates

by Don Schwartz -

Love the block and it works fine. I have a design issue with Theme Essential and am wondering about the ability to choose displayed fields or otherwise have the ability to edit the appearance of the block.

I plan on editing the code myself to remove the grade and code as we don't need them. See how it overlaps with the main content, course list on the front page.


block example

In reply to Manieer Chhettri

Re: Download previously issued certificates

by Dave Emsley -

Hi there,

This looks a great module but we're using 2.9.  Does it work with 2.9?  Or will there be a new version that does?


Cheers


Dave

In reply to Manieer Chhettri

Re: Download previously issued certificates

by Jon Powers -
Good evening,
  I recently discovered and successfully installed the Report Certificates Block and have run into a problem that I hope someone might be able to assist with.

  I'm running 3.0.1 (and I know it is only currently available for 2.8), but I thought I'd try it. It works great! With one issue I'm running into. When a user clicks on the certificate link, if the course is not available and visible, they receive an error message that it is currently not available. If I archive the course, the certificate disappears from the report all together.  According to the description it should be pulling directly from the database but is only pulling from the courses.

 Hope you might have a chance to look into it.

Thank you for your time,
Jon
In reply to Jon Powers

Re: Download previously issued certificates

by Manieer Chhettri -

Thanks Jon,

I am currently investigating this. Will update the plugin once I know what's going on and if I can fix the problem.


Thanks,

M

In reply to Manieer Chhettri

Re: Download previously issued certificates

by Manieer Chhettri -

Hi Jon,

Have spent the weekend exploring this and yes you are right that if the courses are hidden the users cannot access the issued certificate. This is due to the access control or Moodle going through the callback feature which does the permission or capability checks before service the certificate file. So when a course is hidden - before Moodle serves the stored file (in this case certificate file), it checks whether the learners are even allowed to access the course (the certificate file is part of the course). When it finds that learners are not allowed to access hidden courses (moodle/course:viewhiddencourses) then it rejects access to the course and serves you with "This course is hidden message".


Now the only way to resolve this is to create a completely new file serving mechanism for the plugin so it will completely bypasses Moodle's core file serving API. This could potentially create security issues (serving wrong files, security breaches etc). So I will continue to investigate and look at creating a new file serving mechanism but it will have to be heavily tested and understood before releasing it to the community. 


But this is what I have been doing on our live site:

1. Enable moodle/course:viewhiddencourses for  students / learners. You can find this under Define Site administrator>>Users>>Permissions>>Define roles.

2. Now you can hide the relevant courses but make sure you select "Enrolled users only" under Courses administration>>edit settings>>visibility. Also hide all other topics, resources, activities on the main course page except the certificate activity.

3. Now the users can download the hidden / archived certificates.


I know this is not the tidy approach but it works. I will update the plugin if I manage to find alternative solution.


Thanks you.

M



In reply to Manieer Chhettri

Re: Download previously issued certificates

by Larry Lippke -

In the description of this plugin, you commented that this plugin would be helpful in situations where a course was to be archived.  I am looking for a way that a student could retrieve previously issued certificates regardless of the status of the course or the student's enrollment in it.   What I have found with this plugin is that if the course is hidden, or if the student is no long enrolled in the course, the certificate is not available.  If the course is hidden, then the link to retrieve the certificate brings a response that the course is not available to students.  If the student is no long enrolled in the course, then clicking on the link to retrieve the certificate brings up the course enrollment screen.

It seems that if the Moodle database keeps track of the certificate issues, it would also keep track of the directory path and file name of the certificate image (pdf file).

Is there something we've missed somewhere?

In reply to Larry Lippke

Re: Download previously issued certificates

by Manieer Chhettri -

Thanks Jon,

I am currently investigating this. Will update the plugin once I know what's going on and if I can fix the problem.


Thanks,

M

In reply to Manieer Chhettri

Re: Download previously issued certificates

by Larry Lippke -

I should have added that I am on version 2.9.4. 

Larry 

In reply to Larry Lippke

Re: Download previously issued certificates

by Manieer Chhettri -

Hi Larry,

Have spent the weekend exploring this and yes you are right that if the courses are hidden the users cannot access the issued certificate. This is due to the access control or Moodle going through the callback feature which does the permission or capability checks before service the certificate file. So when a course is hidden - before Moodle serves the stored file (in this case certificate file), it checks whether the learners are even allowed to access the course (the certificate file is part of the course). When it finds that learners are not allowed to access hidden courses (moodle/course:viewhiddencourses) then it rejects access to the course and serves you with "This course is hidden message".


Now the only way to resolve this is to create a completely new file serving mechanism for the plugin so it will completely bypasses Moodle's core file serving API. This could potentially create security issues (serving wrong files, security breaches etc). So I will continue to investigate and look at creating a new file serving mechanism but it will have to be heavily tested and understood before releasing it to the community. 


But this is what I have been doing on our live site:

1. Enable moodle/course:viewhiddencourses for  students / learners. You can find this under Define Site administrator>>Users>>Permissions>>Define roles.

2. Now you can hide the relevant courses but make sure you select "Enrolled users only" under Courses administration>>edit settings>>visibility. Also hide all other topics, resources, activities on the main course page except the certificate activity.

3. Now the users can download the hidden / archived certificates.


I know this is not the tidy approach but it works. I will update the plugin if I manage to find alternative solution.


Thanks you.

M