BUG FIXED – user answer only 1 time each quiz
-
hey mate, GREAT plugin, but I found a glitch, when the quiz only takes 1 try per user, and you got several quizzes, the quizzes that the user did not answer think he already answered them and does not let em answer…
FOR EXAMPLE:
user : jarbas
quizzes : quiz 001, quiz002
parameters: quiz 001 only 1 try per user, quiz 002 only 1 try per userjarbas answers quiz 001. jarbas goes to quiz 002 and quiz 002 thinks he already answered it. does not allow jarbas to answer ‘again’.
the bug is a faulty sql query in the mlw_quiz.php, lines from 30 to 38, u need to check instead of just searching for the user email, also the quiz_id to make sure that user email appears at least (in my example) 1 time given that quiz_id for quiz 001 OR quiz_id for quiz 002, depending on wich one you are looking at at the moment.
check out this code, did not change almost anything.
//aqui eu checo SE o número máximo de tentativas n?o é ilimitado E se o user está logado... if ( $mlw_quiz_options->total_user_tries != 0 && is_user_logged_in() ) { //se estiver logado e houver um numero máximo de tentativas, eu verifico se ele já estourou ou n?o esse máximo... $current_user = wp_get_current_user(); //pelo que eu to vendo aqui, o sistema original só procura o quiz pelo endere?o de e-mail do usuário e n?o o email do user + o id do quiz... $mlw_qmn_user_try_count = $wpdb->get_var($wpdb->prepare( "SELECT COUNT(*) FROM ".$wpdb->prefix."mlw_results WHERE email='%s' AND deleted='0' AND quiz_id='".$mlw_quiz_id."'", $current_user->user_email)); if ($mlw_qmn_user_try_count >= $mlw_quiz_options->total_user_tries) { $mlw_qmn_isAllowed = false; } }
- The topic ‘BUG FIXED – user answer only 1 time each quiz’ is closed to new replies.