General plugins

New activity: Simple Certificate

Matt Bury
Re: New activity: Simple Certificate
Particularly helpful MoodlersPlugin developers

Hi Carlos,

Firstly, thanks for developing and maintaining a very useful and easy to use plugin smile

I think I've found a similar issue. I'm working in both Moodle 3.1 (legacy) & 3.3 (current).

  1. Create simplecertificate instance for a course named "Course A";
  2. Students complete the course and receive certificates for "Course A";
  3. Later the course name is changed to "Course B";
  4. Previously issued certificates still print "Course A," not "Course B";

This doesn't seem to be a major problem until we try to get the course ID, which is the only reliable reference to the course, by searching for the course name in the mdl_course table. DB records in the mdl_simplecertificate_issues table still show the course name at the time they were recorded rather than the current name. In other words, it's not possible to get any information from the course because the identifier that mdl_simplecertificate_issues uses has changed.

Would it be a good idea to also record the course ID for each certificate issued?

Average of ratings: -
Picture of Carlos Alexandre Fonseca
Re: New activity: Simple Certificate
Plugin developers
I will try to explain

mdl_simplecertificate_issues don't make any reference to course id,  it's make reference to  Simple certificate activity  which is in the table mdl_simplicertificate,  this table have a ID reference to the course, so to get the course i will use this query

select c.fullname, from mdl_simplecertificate_issues inner join mdl_simplecertificate on mdl_simplecertificate_issues.certificateid = inner join mdl_course  on where = ......

the coursename in mdl_simplecertificate_issues overrides the real course name (if you use alternate course name option)

Average of ratings: -