Quiz stopped working after moving to Quform2

Home Forums Quform WordPress Quiz stopped working after moving to Quform2

This topic is: not resolved

This topic contains 1 reply, has 2 voices, and was last updated by  Ally 4 months, 1 week ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #26009

    airweb7
    Participant

    Hello

    Please find below the code i used :

    function my_score_counter($form)
    {
    	$score_a = 0; $score_b = 0; $score_c = 0;
    	
    	switch ($form->getValue('iphorm_1_1')) {
        case 'a':
            $score_a++;
            break;
        case 'b':
            $score_b++;
            break;
        case 'c':
            $score_c++;
            break;
        }
    	
    	switch ($form->getValue('iphorm_1_2')) {
        case 'a':
            $score_a++;
            break;
        case 'b':
            $score_b++;
            break;
        case 'c':
            $score_c++;
            break;
        }
    	
    	switch ($form->getValue('iphorm_1_3')) {
        case 'a':
            $score_a++;
            break;
        case 'b':
            $score_b++;
            break;
        case 'c':
            $score_c++;
            break;
        }
    	
    	switch ($form->getValue('iphorm_1_4')) {
        case 'a':
            $score_a++;
            break;
        case 'b':
            $score_b++;
            break;
        case 'c':
            $score_c++;
            break;
        }
    	
    	switch ($form->getValue('iphorm_1_5')) {
        case 'a':
            $score_a++;
            break;
        case 'b':
            $score_b++;
            break;
        case 'c':
            $score_c++;
            break;
        }
    
    	$form->setValue('iphorm_1_6', $score_a);
    	$form->setValue('iphorm_1_7', $score_b);
    	$form->setValue('iphorm_1_8', $score_c);
    }
    add_action('iphorm_pre_validate_1', 'my_score_counter');

    and

    function my_custom_success_message($message, $form)
    {
            $score_a = $form->getValue('iphorm_1_6');
    		$score_b = $form->getValue('iphorm_1_7');
    		$score_c = $form->getValue('iphorm_1_8');
    	
    
    	
    	if ($score_a >= '3') {
    	       /* Reponse A max */
    		   $message = "message ...";
    		 
     
    		   return $message;
    		   exit;
    		   	    }
    			   
        if ($score_b >= '3') {
    	       /* Reponse B max */
    	       $message = "message ...";
    		   
    		   
           return $message;
    		   exit;
    		   	    }
    				
    				if ($score_c >= '3') {
    				/* Reponse C max */
    	       $message = "message ...";
    		   
    		  
           return $message;
    		   exit;
    		   	    }
    				
    				
    				if ($score_a == $score_b) {
    				/* Reponse A = B */
    	       $message = "message ...";
    		   	   
           } elseif ($score_a == $score_c) {
    		   /* Reponse A = C */
    		   $message = "message ...";
    		   
           } else {
    		        /* Reponse B = C */
                    $message = "message....";
    				        
              }
    		   
    		  return $message;
    		   
    		   
    		  
    }
    add_filter('iphorm_success_message_1', 'my_custom_success_message', 10, 2);

    How can I adpat to the new Quform version ?

    Thank you

    • This topic was modified 4 months, 1 week ago by  Ally. Reason: Fixed code formatting
    #26035

    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.