function course_certificate_access_certificate in Course 6
Same name and namespace in other branches
- 7.2 modules/course_certificate/course_certificate.module \course_certificate_access_certificate()
- 7 modules/course_certificate/course_certificate.module \course_certificate_access_certificate()
Implements hook_access_certificate().
If something entered a complete record into the reports table, return TRUE.
File
- modules/
course_certificate/ course_certificate.module, line 36
Code
function course_certificate_access_certificate($node, $user) {
if (course_node_is_course($node)) {
$course = course_get_course($node);
$has_certificate = course_certificate_course_has_certificate($course);
$sql = "SELECT 1 FROM {course_report} WHERE nid = %d AND uid = %d AND complete = %d";
return $has_certificate && (bool) db_result(db_query($sql, $node->nid, $user->uid, 1));
}
}