WordPress.org

Forums

WP Survey And Quiz Tool
Results duplicated 4 times on results display page (12 posts)

  1. WP-creative
    Member
    Posted 3 years ago #

    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.

    Notes:
    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!
    Jon

  2. Jackson Murphy
    Member
    Posted 3 years ago #

    I'm having that issue too...
    Any solution?

  3. WP-creative
    Member
    Posted 3 years ago #

    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?

  4. Ollie Armstrong
    Member
    Plugin Author

    Posted 3 years ago #

    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?

    Ollie

  5. Ollie Armstrong
    Member
    Plugin Author

    Posted 3 years ago #

    All,

    This issue has now been fixed.

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

    Sorry it took so long.
    Ollie

  6. mrjarbenne
    Member
    Posted 3 years ago #

    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?

  7. Ollie Armstrong
    Member
    Plugin Author

    Posted 3 years ago #

    mrjarbenne,

    I haven't uploaded this to the WordPress.org 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.

    Thanks,
    Ollie

  8. sulmanpucit
    Member
    Posted 3 years ago #

    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!
    Thanks
    ==================================================

  9. Ollie Armstrong
    Member
    Plugin Author

    Posted 3 years ago #

    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.

    Ollie

  10. sulmanpucit
    Member
    Posted 3 years ago #

    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;
    					break;
    			}
    
    			foreach ( $quizSection['questions'] as $question ){
    				$totalPoints += $question['points'];
    			}
    
    			if ( !isset($quizSection['stats']) ) {
    				continue;
    			}
    
    			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->query(
    				$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)",
    								   array($timeTaken,
    							   		 serialize($_SESSION['wpsqt'][$quizName]['person']),
    							   		 serialize($_SESSION['wpsqt'][$quizName]['sections']),
    							   		 $_SESSION['wpsqt'][$quizName]['details']['id'],
    							   		 $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) ){
    			Wpsqt_Mail::sendMail();
    		}
    
    		require_once Wpsqt_Core::pageView('site/'.$this->_type.'/finished.php');
    		if ( $this->_type == "survey" ){
    			$this->_cacheSurveys();
    		}
    
    		/* Custome code */
    		global $current_user;
         	get_currentuserinfo();
    
    		$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> ,
    		<code>result_id</code>
    		)
    		VALUES (
    		NULL , $user_id ,$quizId, '$resultId'
    		);";
    		$wpdb->query($query);
    		/* Custom Code */
    
    		unset($_SESSION['wpsqt']['result_id']);
    	}

    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();
    
    		jQuery.ajax({
    		type: "POST",
    		url: "  <?php echo esc_url($_SERVER["REQUEST_URI"]); ?>",
    		data: formData,
    		success: function(msg){
    		}
    		});

    Can you please figure out what could be wrong?

  11. sulmanpucit
    Member
    Posted 3 years ago #

    What i have figured out so far is
    $_SESSION['wpsqt'][$quizName]['sections']
    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.

  12. swapnil.shinde1990
    Member
    Posted 3 years ago #

    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...

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic