drupal_set_message(t('You are marked as an administrator or owner for this @quiz. While you can take this @quiz, the open/close times prohibit other users from taking this @quiz.',array('@quiz'=>QUIZ_NAME)),'status');
}
else{
drupal_set_message(t('This @quiz is not currently available.',array('@quiz'=>QUIZ_NAME)),'status');
// Can't take quiz.
returnFALSE;
}
}
}
// Check to see if this user is allowed to take the quiz again:
if($quiz->takes>0){
$taken=db_query("SELECT COUNT(*) AS takes FROM {quiz_node_results} WHERE uid = :uid AND nid = :nid",array(':uid'=>$user->uid,':nid'=>$quiz->nid))->fetchField();
...
...
@@ -2395,22 +2378,28 @@ function quiz_start_check($quiz) {
functionquiz_availability($quiz){
global$user;
if($user->uid==0&&$quiz->takes>0){
returnt('This @quiz only allows %num_attempts attempts. Anonymous users can only access quizzes that allows an unlimited number of attempts.',array('%num_attempts'=>$quiz->takes,'@quiz'=>QUIZ_NAME));
}
$user_is_admin=user_access('edit any quiz content')||(user_access('edit own quiz content')&&$quiz->uid==$user->uid);
if($user_is_admin||$quiz->quiz_always==1){
returnTRUE;
}
// Compare current GMT time to the open and close dates (which should still be
// in GMT time).
$now=REQUEST_TIME;
// Make sure this is available.
if($quiz->quiz_always!=1){
// Compare current GMT time to the open and close dates (which should still
returnt('You are marked as an administrator or owner for this @quiz. While you can take this @quiz, the open/close times prohibit other users from taking this @quiz.',array('@quiz'=>QUIZ_NAME));
}
else{
returnt('This @quiz is closed.',array('@quiz'=>QUIZ_NAME));