Call to undefined function ```$feedback = quiz_question_feedback($quiz, $question_node);``` on line 127 of the ajax_quiz.module file.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ULikeApples created an issue. See original summary.

funex’s picture

We're also finding this issue. Did you find a solution?

Da_Cloud’s picture

This function seem to have been removed when converting the reports to Drupal views.
#2281823: Convert unevaluated reports to a view

Simply adding the function back doesn't seem to solve the issue though. While it stops the fatal errors, my test case would simply end up with a blank screen where should have been a feedback report.

/**
 * Return a form with question feedback.
 */
function quiz_question_feedback($quiz, $question) {
  if (empty($_SESSION['quiz'][$quiz->nid]['result_id'])) {
    $result_id = $_SESSION['quiz']['temp']['result_id'];
  }
  else {
    $result_id = $_SESSION['quiz'][$quiz->nid]['result_id'];
  }

  $quiz_result = quiz_result_load($result_id);
  $questions = array($question);
  foreach ($quiz_result->getLayout() as $question_array) {
    if ($question_array['nid'] == $question->nid) {
      // Found this question.
      if ($question_array['qnr_pid']) {
        // Belongs to a page. Find other questions.
        $questions = array();
        foreach ($quiz_result->getLayout() as $question2) {
          if ($question2['qnr_pid'] == $question_array['qnr_pid']) {
            // This question belongs in the requested page.
            $questions[] = node_load($question2['nid'], $question2['vid']);
          }
        }
        break;
      }
    }
  }
  
  module_load_include('inc', 'quiz', 'quiz.pages');
  if ($questions) {
    $report_form = drupal_get_form('quiz_report_form', $questions, $result_id);
    return $report_form;
  }
}
djdevin’s picture

It was removed because it was deprecated, the new way to show question feedback is to use the quiz_take_question_feedback_form() form

It looks like ajax_quiz did use this but we should be able to fix it.

ss_for’s picture

In version quiz 7.x-5.x-dev the problem remained.
Is it planned to fix it?
File ajax_quiz.module (line 123-129)

   if ($question_node) {
      // Getting feedback?
      if ($form_state['feedback']) {
        // Load the feedback form.
        $feedback = quiz_question_feedback($quiz, $question_node);
        $commands[] = ajax_command_replace('#ajax-quiz-wrapper', drupal_render($feedback));
      }
vensires’s picture

Version: 7.x-5.0 » 7.x-5.3

It's still an issue.

djdevin’s picture

Version: 7.x-5.3 » 7.x-5.x-dev
Status: Active » Needs review
FileSize
5.63 KB

A little fragile but this seems to work.

skylord’s picture

Works OK for Quiz 7.x-5.5. Thanks!

Status: Needs review » Needs work

The last submitted patch, 7: 2855249-restore-ajax-quiz-feedback.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

apaderno’s picture

djdevin’s picture

Status: Needs work » Closed (outdated)