function quiz_access_my_results in Quiz 6.4
Same name and namespace in other branches
- 8.4 quiz.module \quiz_access_my_results()
- 7.6 quiz.module \quiz_access_my_results()
- 7 quiz.module \quiz_access_my_results()
- 7.4 quiz.module \quiz_access_my_results()
- 7.5 quiz.module \quiz_access_my_results()
Helper function to determine if a user has access to view his quiz results
Parameters
object $quiz: The Quiz node
1 string reference to 'quiz_access_my_results'
- quiz_menu in ./
quiz.module - Implementation of hook_menu().
File
- ./
quiz.module, line 171 - Quiz Module
Code
function quiz_access_my_results($quiz) {
global $user;
if ($quiz->type !== 'quiz') {
return FALSE;
}
if (user_access('view own quiz results') && !quiz_access_results($quiz)) {
$answered = db_result(db_query_range('SELECT 1
FROM {quiz_node_results}
WHERE nid = %d AND uid = %d AND is_evaluated = 1', $quiz->nid, $user->uid, 0, 1));
if ($answered) {
return TRUE;
}
}
}