Certificate 2012040201 error on first click

Certificate 2012040201 error on first click

by Nicole Ralph -
Number of replies: 1

Hello,

We are using Moodle 2.1.2 and Moodle Certificate 2012040201

Background
We updated to Moodle Certificate 2012040201 yesterday.
Initially after the upgrade the Certificate threw to a white blank screen.  We corrected this by updating the code in the lib.php file.

The problem
This morning we have found when a user selects the certificate for the first time the following message appears:

"Coding error detected, it must be fixed by a programmer: Invalid context specified"

"More information about this error"

http://docs.moodle.org/21/en/error/debug/codingerror

We switched on the debugging page to reveal:

Error: could not insert new context level "70", instance "87". cm with id 87 does not exist
• line 1882 of /lib/accesslib.php: call to debugging()
• line 2218 of /lib/accesslib.php: call to create_context()
• line 334 of /mod/certificate/lib.php: call to get_context_instance()
• line 394 of /mod/certificate/lib.php: call to certificate_get_teachers()
• line 878 of /mod/certificate/lib.php: call to certificate_email_teachers()
• line 121 of /mod/certificate/view.php: call to certificate_issue()


The crazy thing is the message is intermitant.  Should the user ignore the error and cleck the certificate for a second time the Certificate will display and all is well.

What we have noted is if the date is visable on screen (see attached image) the certificate will appear.  If the date is not present then 100% of the time the error will show.

Any assistance would be greatly appreciated
Nicole and Richard C.

Attachment Cert date.jpg
Average of ratings: -
In reply to Nicole Ralph

Re: Certificate 2012040201 error on first click

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

Hi Nicole,

I don't suggest just advising the students to ignore this error as a solution to the problem smile

The certificate version you are using is correct, but for some reason the get_context_instance call is on a different line number than where it should be in lib.php, the same is for certificate_issue in the view.php file! Did you download the update from https://github.com/PukunuiAustralia/moodle-mod_certificate?

Regards,

Mark