function quiz_is_passed in Quiz 7.5
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.4 quiz.module \quiz_is_passed()
Check a user/quiz combo to see if the user passed the given quiz.
Parameters
int $uid: The user ID.
int $nid: The node ID.
int $vid: The version ID.
Return value
bool Returns 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.
Related topics
2 calls to quiz_is_passed()
- quiz_end_scoring in ./
quiz.module - Score a completed quiz.
- quiz_quiz_access in ./
quiz.module - Can a user take this quiz?
File
- ./
quiz.module, line 2152 - quiz.module Main file for the 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 score >= pass_rate', array(
':vid' => $vid,
':nid' => $nid,
':uid' => $uid,
))
->fetchField();
// Force into boolean context.
return $passed !== FALSE && $passed > 0;
}