function quiz_access_my_result in Quiz 7.6
Same name and namespace in other branches
- 8.4 quiz.module \quiz_access_my_result()
- 6.4 quiz.module \quiz_access_my_result()
- 7.4 quiz.module \quiz_access_my_result()
- 7.5 quiz.module \quiz_access_my_result()
Helper function to determine if a user has access to view a specific quiz result.
Parameters
int $result_id: Result id
Return value
boolean True if access, false otherwise
1 string reference to 'quiz_access_my_result'
- quiz_menu in ./
quiz.module - Implements hook_menu().
File
- ./
quiz.module, line 231 - quiz.module Main file for the Quiz module.
Code
function quiz_access_my_result($result_id) {
global $user;
// Check if the quiz taking has been completed.
if ($quiz_result = quiz_result_load($result_id)) {
$node = node_load($quiz_result->nid, $quiz_result->vid);
if (quiz_access_to_score($node->uid) || $quiz_result->time_end > 0 && $quiz_result->uid == $user->uid) {
return TRUE;
}
}
return FALSE;
}