Skip to content

Commit

Permalink
Check that a certificate issue exists (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjnelson committed May 23, 2019
1 parent 1ac494d commit 0b0b37e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions my_certificates.php
Expand Up @@ -30,6 +30,11 @@
if ($downloadcert) {
$certificateid = required_param('certificateid', PARAM_INT);
$customcert = $DB->get_record('customcert', array('id' => $certificateid), '*', MUST_EXIST);

// Check there exists an issued certificate for this user.
if (!$issue = $DB->get_record('customcert_issues', ['userid' => $userid, 'customcertid' => $customcert->id])) {
throw new moodle_exception('You have not been issued a certificate');
}
}
$page = optional_param('page', 0, PARAM_INT);
$perpage = optional_param('perpage', \mod_customcert\certificate::CUSTOMCERT_PER_PAGE, PARAM_INT);
Expand Down

0 comments on commit 0b0b37e

Please sign in to comment.