UQM Configuration

All web design discussion, including Ultimate Quiz MOD support.

Moderator: CricketMX Forum Moderators

Post Reply
webmaster609
Greenhorn
Greenhorn
Posts: 11
Joined: Tue Apr 25, 2006 1:57 pm
Location: England
Contact:

It would appear that the UQM marks an answer incorrect if it is not typed in exactly as per the submitted answer...i.e: correct spelling, capitalization etc..... is there any way to relax the settings so it will ignore capitalization etc?
User avatar
battye
Site Admin
Site Admin
Posts: 14391
Joined: Sun Jan 11, 2004 8:26 am
Location: Australia
Contact:

In future versions, I will relax the settings on capital letters, but there's not a lot I can do for correct spelling etc.

Here is a quick fix (it is untested though, so if you experience any problems, remove it immediately).

Open quiz.php, FIND

Code: Select all

			if($user_answer == $actual_answer)
			{
				$correct[$i] = 1;
				$incorrect[$i] = 0;
				
				// The message consists of Question: Your Answer: Actual Answer
				$status = sprintf($lang['Quiz_answer_status'], $user_answer, '<font color="green">' . $actual_answer . '</font>');
			}
			
			else if($user_answer != $actual_answer)
			{
				$correct[$i] = 0;
				$incorrect[$i] = 1;
				$status = sprintf($lang['Quiz_answer_status'], $user_answer, '<font color="red">' . $actual_answer . '</font>');
			}
REPLACE THAT ENTIRE SECTION WITH

Code: Select all

			if(strtoupper($user_answer) == strtoupper($actual_answer))
			{
				$correct[$i] = 1;
				$incorrect[$i] = 0;
				
				// The message consists of Question: Your Answer: Actual Answer
				$status = sprintf($lang['Quiz_answer_status'], $user_answer, '<font color="green">' . $actual_answer . '</font>');
			}
			
			else if(strtoupper($user_answer) != strtoupper($actual_answer))
			{
				$correct[$i] = 0;
				$incorrect[$i] = 1;
				$status = sprintf($lang['Quiz_answer_status'], $user_answer, '<font color="red">' . $actual_answer . '</font>');
			}
The modifications that are being made are changing the 'if' and 'else if' lines, so that it sees all answers in the database as entirely in caps, and all the answers submitted by the user, entirely in caps, so that there won't be any conflict with capital letters :)

For example, before, it might say in the database that the answer was 'Gift', and the user typed in 'gift', and result in a 'no match'. This change will alter the database answer to GIFT (all caps) and the user answer to GIFT also, meaning there is a match now :)
CricketMX.com in 2022: Still the home of bat's, rat's and other farmyard animals!

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
webmaster609
Greenhorn
Greenhorn
Posts: 11
Joined: Tue Apr 25, 2006 1:57 pm
Location: England
Contact:

Battye,

Thanks for that quick fix mate...seems to be working fine..will let u know if any probs arise with it :0
Post Reply