Support » Plugin: WP Survey And Quiz Tool » Results duplicated 4 times on results display page

  • Hello,
    When a user on our site completes a quiz, it shows the results on the page 4 times – repeats the results section 4 times in a row on the results page.

    Wordpress 3.1.2
    Thesis theme 1.8
    WPQST 2.0 beta 3

    Only one other plugin active: Verve Meta Boxes, which I am using to create contextual sidebar menus.

    I don’t dare deactivate the plugin because I have 8 complete quizzes and have not figured out how to create a backup?

    Any help, ideas?
    Thanks in advance!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Jackson Murphy


    I’m having that issue too…
    Any solution?

    I deactivated all plugins and it did not fix the problem.
    I verified I was running PHP5.
    I went through and resaved almost all the questions – did not help.
    I turned on and off the ‘review’ feature. Did nothing.
    I deactivated and reactivated the WPQS plugin. Did not help.

    The only thing I have not done is uninstall the plugin – since I don’t want to lose the three hours worth of data entry it took to create all 8 quizzes.

    Any one else have any ideas?

    What would cause a program to ‘echo’ the same thing 4 times instead of once?

    Plugin Author Ollie Armstrong


    This is an issue I have been able to reproduce. Working on it now, will have a fix for you shortly.

    Can I confirm that you have activated the Quiz Review option in the quiz settings page?


    Plugin Author Ollie Armstrong



    This issue has now been fixed.

    Please replace your pages/site/quiz/review.php file with this one.

    Sorry it took so long.

    New user looking for a quiz solution. Have you loaded this into the repo as an update, or should I DL the plugin and make the changes manually?

    Plugin Author Ollie Armstrong



    I haven’t uploaded this to the repo as an update yet. I am working on a couple more fixes before I push an update. Until then, you can download the most recent version of the plugin from my GitHub repo.


    Same is happening with me. But let me tell you there is no issue with my review page. because i have seen in database “wp_wpsqt_all_results” table. It is saving same survey question with new answers.
    I have also posted this issue on WPQST.
    Here is my post
    Hi, can you please help me?
    I am using your plugin with my custom code.
    I have added surveys and quizes to pages and i am showing those pages in Pop-ups and submitting forms through ajax.
    Now problem is that sometime it works fine but sometime question display fine but result that is been stored in database is a mixture of some old survery/quiz. Like if i have first form with 10 fields and another form with just one field.
    Now when i submit second form.
    Result that is being stored in database table “wp_wpsqt_all_results” is like this.
    “Questions of first form and answers of second form.” which is very strange.
    Can you please help me to sort it out? I am in very critical situation!

    Plugin Author Ollie Armstrong


    I can’t really help you when you are using custom code and I can’t see it. Please try and get a test wordpress install with the latest version of WPSQT and see if the issue still occurs there. If it doesn’t then it is your code – I may be able to help you if I can see the scripts you are using.


    hmm, well I have not changed plugin code. I have just added my own to some pages which shouldnt break plugin functionliaty.
    Here is code for FinishQuiz function.

    global $wpdb;
    		$quizName = $_SESSION['wpsqt']['current_id'];
    		if ( $_SESSION['wpsqt'][$quizName]['details']['use_wp'] == 'yes'){
    			$objUser = wp_get_current_user();
    			$_SESSION['wpsqt'][$quizName]['person']['name'] = $objUser->user_login;
    			$_SESSION['wpsqt'][$quizName]['person']['email'] = $objUser->user_email;
    		$personName = (isset($_SESSION['wpsqt'][$quizName]['person']['name'])) ? $_SESSION['wpsqt'][$quizName]['person']['name'] :  'Anonymous';
    		$timeTaken = microtime(true) - $_SESSION['wpsqt'][$quizName]['start_time'];
    		$totalPoints = 0;
    		$correctAnswers = 0;
    		$canAutoMark = true;
    		foreach ( $_SESSION['wpsqt'][$quizName]['sections'] as $quizSection ){
    			if ( $this->_type != "quiz" || ( isset($quizSection['can_automark']) && $quizSection['can_automark'] == false) ){
    				$canAutoMark = false;
    			foreach ( $quizSection['questions'] as $question ){
    				$totalPoints += $question['points'];
    			if ( !isset($quizSection['stats']) ) {
    			if ( isset($quizSection['stats']['correct']) ){
    				$correctAnswers += $quizSection['stats']['correct'];
    		if ( $canAutoMark === true ){
    			$_SESSION['wpsqt']['current_score'] = $correctAnswers." correct out of ".$totalPoints;
    		} else {
    			$_SESSION['wpsqt']['current_score'] = "quiz can't be auto marked";
    		if ( $correctAnswers !== 0 ){
    			$percentRight = ( $correctAnswers / $totalPoints ) * 100;
    		} else {
    			$percentRight = 0;
    		if ( !isset($_SESSION['wpsqt'][$quizName]['details']['store_results']) ||  $_SESSION['wpsqt'][$quizName]['details']['store_results'] !== "no" ){
    				$wpdb->prepare("INSERT INTO <code>&quot;.WPSQT_TABLE_RESULTS.&quot;</code> (timetaken,person,sections,item_id,person_name,ipaddress,score,total,percentage)
    								VALUES (%d,%s,%s,%d,%s,%s,%d,%d,%d)",
    							   		 $personName,$_SERVER['REMOTE_ADDR'],$correctAnswers,$totalPoints,$percentRight ) )
    			$_SESSION['wpsqt']['result_id'] = $wpdb->insert_id;
    		} else {
    			$_SESSION['wpsqt']['result_id'] = null;
    		$emailAddress = get_option('wpsqt_contact_email');
    		if ( $_SESSION['wpsqt'][$quizName]['details']['notificaton_type'] == 'instant' ){
    			$emailTrue = true;
    		} elseif ( $_SESSION['wpsqt'][$quizName]['details']['notificaton_type'] == 'instant-100'
    					&& $percentRight == 100 ) {
    			$emailTrue = true;
    		} elseif ( $_SESSION['wpsqt'][$quizName]['details']['notificaton_type'] == 'instant-75'
    					 && $percentRight > 75 ){
    			$emailTrue = true;
    		} elseif ( $_SESSION['wpsqt'][$quizName]['details']['notificaton_type'] == 'instant-50'
    					&& $percentRight > 50 ){
    			$emailTrue = true;
    		} elseif ( $_SESSION['wpsqt'][$quizName]['details']['send_user'] == 'yes' ) {
    			$emailTrue = true;
    		if ( isset($emailTrue) ){
    		require_once Wpsqt_Core::pageView('site/'.$this->_type.'/finished.php');
    		if ( $this->_type == "survey" ){
    		/* Custome code */
    		global $current_user;
    		$quizId = $_SESSION['wpsqt'][$quizName]['details']['id'];
    		$resultId = $_SESSION['wpsqt']['result_id'];
    		$user_id = $current_user->ID;
    		$query = "INSERT INTO <code>user_quizes</code> (
    		<code>id</code> ,
    		<code>user_id</code> ,
    		<code>quiz_id</code> ,
    		VALUES (
    		NULL , $user_id ,$quizId, '$resultId'
    		/* Custom Code */

    The onnly other other change which i have made is i am posting form through AJAX by serializing fields.
    And here is my code for this purpose.

    var formData = jQuery("#form").serialize();
    		type: "POST",
    		url: "  <?php echo esc_url($_SERVER["REQUEST_URI"]); ?>",
    		data: formData,
    		success: function(msg){

    Can you please figure out what could be wrong?

    What i have figured out so far is
    this session variable doesnt get updated next time, even at first time. Can you please tell me where they are doing this stuff? It seems tricky.

    I am using WPQST v2.6.3 . I conducted the quiz test for around 300 people at one time for 1 hour. People who gave the test came across the following error.
    PHP Sessions error. Check your sessions settings.

    Please help me immediately…

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Results duplicated 4 times on results display page’ is closed to new replies.