You are here

function quiz_access_my_result in Quiz 6.4

Same name and namespace in other branches
  1. 8.4 quiz.module \quiz_access_my_result()
  2. 7.6 quiz.module \quiz_access_my_result()
  3. 7.4 quiz.module \quiz_access_my_result()
  4. 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 $rid: Result id

Return value

boolean True if access, false otherwise

1 string reference to 'quiz_access_my_result'
quiz_menu in ./quiz.module
Implementation of hook_menu().

File

./quiz.module, line 196
Quiz Module

Code

function quiz_access_my_result($rid) {
  global $user;
  if (!user_access('view own quiz results')) {
    return FALSE;
  }
  $time_end = db_result(db_query('SELECT time_end FROM {quiz_node_results} WHERE result_id = %d AND uid = %d', $rid, $user->uid));
  return $time_end > 0;
}