function quiz_is_passed in Quiz 7.4
Same name and namespace in other branches
- 8.6 quiz.module \quiz_is_passed()
- 8.4 quiz.module \quiz_is_passed()
- 8.5 quiz.module \quiz_is_passed()
- 6.6 quiz.module \quiz_is_passed()
- 6.2 quiz.module \quiz_is_passed()
- 6.3 quiz.module \quiz_is_passed()
- 6.4 quiz.module \quiz_is_passed()
- 6.5 quiz.module \quiz_is_passed()
- 7.6 quiz.module \quiz_is_passed()
- 7 quiz.module \quiz_is_passed()
- 7.5 quiz.module \quiz_is_passed()
Check a user/quiz combo to see if the user passed the given quiz.
This will return TRUE if the user has passed the quiz at least once, and FALSE otherwise. Note that a FALSE may simply indicate that the user has not taken the quiz.
Parameters
$uid: The user ID.
$nid: The node ID.
$vid: The version ID.
Related topics
2 calls to quiz_is_passed()
- quiz_end_scoring in ./
quiz.module - Score a completed quiz.
- quiz_start_check in ./
quiz.module - Actions to take place at the start of a quiz.
File
- ./
quiz.module, line 2815 - Quiz Module
Code
function quiz_is_passed($uid, $nid, $vid) {
$passed = db_query('SELECT COUNT(result_id) AS passed_count FROM {quiz_node_results} qnrs
INNER JOIN {quiz_node_properties} USING (vid, nid)
WHERE qnrs.vid = :vid
AND qnrs.nid = :nid
AND qnrs.uid = :uid
AND qnrs.is_evaluated = 1
AND score >= pass_rate', array(
':vid' => $vid,
':nid' => $nid,
':uid' => $uid,
))
->fetchField();
// Force into boolean context.
return $passed !== FALSE && $passed > 0;
}