function opigno_og_prereq_user_passed_course in Opigno 7
1 call to opigno_og_prereq_user_passed_course()
- opigno_og_prereq_og_role_grant in modules/
og_prereq/ opigno_og_prereq.module - Implements hook_og_role_grant().
File
- modules/
og_prereq/ opigno_og_prereq.module, line 95 - Module hook implementations.
Code
function opigno_og_prereq_user_passed_course($uid, $course) {
if (!empty($course->course_required_quiz_ref)) {
foreach ($course->course_required_quiz_ref as $lang => $items) {
foreach ($items as $item) {
$quiz = node_load($item['target_id']);
if (isset($quiz)) {
$score = @current(quiz_get_score_data(array(
$quiz->nid,
), $uid));
if (empty($score->percent_score) || $score->percent_score < $score->percent_pass) {
return FALSE;
}
}
}
}
}
return TRUE;
}