• Resolved webgoddess77

    (@webgoddess77)


    Hi! I’m trialling this plugin for use as a trivia quiz on my site, and so far it’s working great. I’ve been using the option to “Dynamically add class for incorrect/correct answer after user selects answer”, and I noticed tonight that it failed to insert the class correctly whenever I had an answer with a single or double quote.

    This worked: He is barefoot
    This didn’t work: He’s barefoot

    After much digging, I found the solution so I thought I’d share it in the hopes it can be updated in the future.

    File: question-types.php
    Line 43:

    $question_display .= "<input type='radio' class='qmn_quiz_radio' name='question".$id."' id='question".$id."_".$mlw_answer_total."' value='".esc_attr($answer[0])."' /> <label for='question".$id."_".$mlw_answer_total."'>".htmlspecialchars_decode($answer[0], ENT_QUOTES)."</label>";

    There’s a missing htmlentities that should be in there on the input value.

    This fixes the issue for me:

    $question_display .= "<input type='radio' class='qmn_quiz_radio' name='question".$id."' id='question".$id."_".$mlw_answer_total."' value='".htmlentities(esc_attr($answer[0]))."' /> <label for='question".$id."_".$mlw_answer_total."'>".htmlspecialchars_decode($answer[0], ENT_QUOTES)."</label>";

  • The topic ‘Bug fix for dynamically adding class for incorrect answers’ is closed to new replies.