function quiz_quiz_finished in Quiz 6.6        
                          
                  
                        Same name and namespace in other branches
- 6.3 quiz.module \quiz_quiz_finished()
- 6.4 quiz.module \quiz_quiz_finished()
- 6.5 quiz.module \quiz_quiz_finished()
- 7.6 quiz.module \quiz_quiz_finished()
- 7 quiz.module \quiz_quiz_finished()
- 7.4 quiz.module \quiz_quiz_finished()
File
 
   - ./quiz.module, line 1348
- Quiz Module
Code
function quiz_quiz_finished($quiz, $score, $rid) {
  global $user;
  
  
  if ($user->uid == 0 && variable_get('quiz_results_to_quiz_author', 1)) {
    $author = user_load($quiz->uid);
    drupal_mail('quiz', 'notice', $author->mail, NULL, array(
      $quiz,
      $score,
      $rid,
    ));
  }
  
  if (variable_get('quiz_email_results', 1) && variable_get('quiz_use_passfail', 1) && $user->uid != 0) {
    drupal_mail('quiz', 'notice', $user->mail, NULL, array(
      $quiz,
      $score,
      $rid,
    ));
    drupal_set_message(t('Results has been sent to your e-mail ID.'));
  }
  
  
  if ($quiz->has_userpoints) {
    $variables = array(
      '@title' => $quiz->title,
      '@quiz' => variable_get('quiz_name', QUIZ_NAME),
      '@time' => date('l jS \\of F Y h:i:s A'),
    );
    $params = array(
      'points' => $score['numeric_score'],
      'description' => t('Attened @title @quiz on @time', $variables),
    );
    userpoints_userpointsapi($params);
  }
}