certificate dependant on feedback

Re: certificate dependant on feedback

by John Anderson -
Number of replies: 0

I came back to this because I think I found a solution / correction.

in the certificate lib.php file I made this change and got it working with the feedback activity:

} else if ($cm->module == $feedid) {
            echo "found feedback";
            // return (get_record('feedback_completed', 'id', $cm->instance, 'userid', $userid) !== false);
            return (get_record('feedback_completed', 'feedback', $cm->instance, 'userid', $userid) !== false);

I removed the 'id' column and replaced with the 'feedback' column in the get_record() call. Which was returning FALSE when the 'id' column was part of the query. Only thing I can think is that maybe 'id' is causing a name space conflict with some other use of 'id' in this instance? Or just can't read from the table key column?

Anyway, after studying the questionnaire module (it works fine with certificate) I noticed it was calling 'qid' column (id of the questionnaire) and not the the 'id' of the table 'questionnaire_attempts'. So 'feedback_completed' is structured much the same way, and so I plugged 'feedback' column in (id of the feedback activity) and it started returning TRUE (yep found this record) and working correctly!

So I can stop using the sidebar block trick, a pain to explain to other users how/why you need to hide a certificate.

Pretty old junk but I'm happy! smile