WordPress.org

Ready to get started?Download WordPress

Forums

WP Survey And Quiz Tool
Possible to submit empty quizzes (9 posts)

  1. cagsmith
    Member
    Posted 2 years ago #

    The validation to check if a user has missed any quiz questions triggers correctly, but only if at least one question has been answered. If you create a quiz and leave all answers untouched and click Next then it will validate the quiz and take you to the results page.

    http://wordpress.org/extend/plugins/wp-survey-and-quiz-tool/

  2. Ollie Armstrong
    Member
    Plugin Author

    Posted 2 years ago #

    Will take a look at this soon.

  3. mystifier
    Member
    Posted 2 years ago #

    if ( isset($_POST['answers']) ){

    Needs moving down from line 280 to 289 in:
    lib/Wpsqt/Shortcode.php

  4. cagsmith
    Member
    Posted 2 years ago #

    Hi mystifier - nice one. Seems to have done the trick :) Thanks a lot!

  5. nono33z
    Member
    Posted 2 years ago #

    hi,

    i have the same problem
    Can you explain me more, the solution

    I don't understand well "Needs moving down from line 280 to 289"

    thanks !!

  6. cagsmith
    Member
    Posted 2 years ago #

    nono33z - you need to make sure you have the most up-to-date version of the plugin. At first, I didn't - that's why the line doesn't show up where mystifier said it would.

    When you have updated the plugin, browse to the plugin directory using your FTP client, go to the directory mystifier says above and double-click the file Shortcode.php to open it. Scroll down to line 280 and just move the text from that line down to line 289. That's all :)

  7. nono33z
    Member
    Posted 2 years ago #

    thanks you cagsmith,
    but i'm sorry
    I have to be a little beast! it does not work or I'm not good handling.
    can you copy the code snippet in your message?
    :(

    EDIT : It's work !! I had to work on the wrong version of the file :p

    Thanks a lot.

  8. mystifier
    Member
    Posted 2 years ago #

    In lib/Wpsqt/Shortcode.php around line 280:

    if ( isset($_POST['answers']) ){
      $_SESSION['wpsqt'][$quizName]['sections'][$pastSectionKey]['answers'] = array();
      $canAutoMark = true;
      foreach ($_SESSION["wpsqt"][$quizName]["sections"][$pastSectionKey]["questions"] as $questionData ){
        if ( isset($questionData['required']) && $questionData['required'] == "yes") {
          $requiredQuestions['exist']++;
        }
      }

    Needs to change to:

    $_SESSION['wpsqt'][$quizName]['sections'][$pastSectionKey]['answers'] = array();
      $canAutoMark = true;
      foreach ($_SESSION["wpsqt"][$quizName]["sections"][$pastSectionKey]["questions"] as $questionData ){
        if ( isset($questionData['required']) && $questionData['required'] == "yes") {
          $requiredQuestions['exist']++;
        }
      }
    if ( isset($_POST['answers']) ){

    Because the check for required answers is only done if answers exist.

    EDIT: crossed posts!!

  9. Ollie Armstrong
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks guys, implemented a fix.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic