function og_quiz_access_my_result in OG Quiz 7
Custom access callback for viewing own results.
Parameters
int $rid:
Return value
bool
1 string reference to 'og_quiz_access_my_result'
- og_quiz_menu_alter in ./
og_quiz.module - Implements hook_menu_alter().
File
- ./
og_quiz.module, line 303 - Module hooks and custom logic.
Code
function og_quiz_access_my_result($rid) {
global $user;
$access = FALSE;
$result = db_query('SELECT uid,time_end FROM {quiz_node_results} WHERE result_id = :result_id', array(
':result_id' => $rid,
))
->fetchAssoc();
if (!empty($result)) {
if (user_access('view any quiz results')) {
return TRUE;
}
else {
$access = $result['time_end'] > 0;
if ($access) {
if (!($access = user_access('view own quiz results'))) {
return og_quiz_user_access($user, 'view own quiz results');
}
}
}
}
return $access;
}