WatuPRO Basic Bar Chart

From version 5.0.5 the quiz plugin WatuPRO comes with a basic bar chart shortcode that can be used to display a chart in the final page of the quiz.

The chart can be used for two main purposes:

a) to show how your result compares to the averages of other quiz takers on the same quiz.
b) to show your points vs. maximum possible points chart.
c) to show how your current attempt compares to your previous attempts (for logged in users)

Here are examples of the chart:

Yours vs Average Results:

watupro-barchart

Your own results overview:

(this mode requires at least WatuPRO 5.1.5.5)

chart-overview

This basic chart does not require the Reporting Module. Below is a more detailed explanation how to use the shortcode:

Please note this shortcode can be used only in the quiz output box. At the moment it won’t work anywhere else including certificates.

Using the shortcode

The shortcode to be included in the final screen is [watupro-basic-chart]

It can be used without any attributes in which case will produce a chart like in the image above. You can however use several attributes to customize it:

show  – this attribute defines whether to show both charts, only the points chart, or only the percentages chart. The possible values of this parameter are: ‘both’, ‘points’, ‘percent’, or ‘max_points’. When the value is max_points the chart will display your points vs. maximum possible points bars.

your_color – the color of the bar with user’s stats (your points, your % correct answer). Defaults to blue. Can accept color as a word or as hexadecimal value.

avg_color – the color of the bar with average or maximum stats (avg. points, avg % correct answer). Defaults to gray. Can accept color as a word or as hexadecimal value.

bar_width – the width of the bar in pixels. Defaults to 100.

average – “show” or “hide” depending on whether you want to show the bar with the average values from everyone (or maximum points, depending on “show”). If you omit the argument, it will be shown. If the parameter show is set to max_points, the maximum will always be shown.

The following attributes are not documented in the Help page because using them improperly can cause on-screen errors:

overview – defines how many attempts to show in total and will work only for logged in users. Defaults to 1, i.e. by default it shows only the latest attempt. The max. is 10.
If the parameter show is set to max_points, then overview is always switched off to 1.

your_points_text – defines the text written under “Your points” bar. Defaults to “Your points: %s”. You can change it but it must always include the “%s” variable.

your_overview_points_text – When overview is more than 1, this is the text that will show for the previous attempts. Defaults to “%s: %s”. You can change it but it must always include the “%s” variables because they will be replaced with date and points.

avg_points_text – defines the text written under “Avg. points” or “Max. points” bar. Defaults to “Avg. points: %s”. You can change it but it must always include the “%s” variable.

your_percent_text – defines the text under “Your % correct” bar. Defaults to “You: %d%% correct”. Must always include the “%d” variable.

your_overview_percent_text –When overview is more than 1, this is the text that will show for the previous attempts. Defaults to “%s: %d%% correct”. Must always include the “%s” and  “%d” variable.

avg_percent_text – defines the text under “Avg. % correct” bar. Defaults to “Avg. %d%% correct”. Must always include the “%d” variable.

round_points – set to 1 if you want to not use decimals and have all points rounded.

Here is an example usage including several arguments:

[watupro-basic-chart show="points" your_color="red" avg_color="#00FF00" your_points_text="You: %s points" avg_points_text="Avg.from all users: %s points"]

WatuPRO 5.0.2.4 Critical Bug Fix for WordPress 4.4

Yesterday’s WordPress upgrade to 4.4 is causing a database error when submitting a quiz in most WatuPRO versions and some MySQL versions. This is NOT a security issue but it can cause critical malfunction. So we highly recommend to update to the latest version ASAP.

We are sending version 5.0.2.4 via a newsletter today. If you have not received it, feel free to send us email.

If you have customized the plugin in some way and don’t want to update you can replace only lib/watupro.php where the changes are done. In any other case please update the whole plugin.

If Your Free Support Subscription Has Expired

We sent a newsletter when this bug fix was released. If you missed to update your installation back then and your free support subscription has expired, you have two options:

  • To renew using the 60% promo code. It can be provided to you by email, please contact us.
  • To fix the bug yourself. Open lib/watupro.php and fine the following queries:
if(empty($detail->ID)) {
               $wpdb->insert(WATUPRO_STUDENT_ANSWERS,
                array("user_id"=>$user_ID, "exam_id"=>$exam_id, "taking_id"=>$taking_id,
                    "question_id"=>$question_id, "answer"=>$answer,
                    "points"=>$points, "question_text"=>$question_text, 
                    "is_correct" => $is_correct, 'snapshot'=>$snapshot, 'hints_used'=>$hints, 
                    "num_hints_used" => $no_hints, "onpage_question_num" => @$_POST['current_question'],
                    "feedback" => @$_POST['feedback-'.$question_id],
                    "rating" => intval(@$_POST['question_rating_'.$question_id])),
                array("%d","%d","%d","%d","%s","%f","%s", "%d", "%s", "%s", "%d", "%d", "%s", "%d"));    
                $detail_id = $wpdb->insert_id;            
        }
        else {
                // don't remove the snapshot
                if(empty($snapshot) and !empty($detail->snapshot)) $snapshot = stripslashes($detail->snapshot);            
            
            $wpdb->query($wpdb->prepare("UPDATE ".WATUPRO_STUDENT_ANSWERS." SET
               answer=%s, points=%s, question_text=%s, is_correct=%d, snapshot=%s, hints_used = %s, 
               num_hints_used=%d, onpage_question_num=%d, feedback=%s, rating=%d
               WHERE id=%d", $answer, $points, $question_text, $is_correct, $snapshot, $hints, $no_hints,
               @$_POST['current_question'], @$_POST['feedback-'.$question_id], intval(@$_POST['question_rating_'.$question_id]), $detail->ID ));
            $detail_id = $detail->ID;                 
        }

Change them to:

if(empty($detail->ID)) {
    		   $wpdb->insert(WATUPRO_STUDENT_ANSWERS,
    			array("user_id"=>$user_ID, "exam_id"=>$exam_id, "taking_id"=>$taking_id,
    				"question_id"=>$question_id, "answer"=>$answer,
    				"points"=>$points, "question_text"=>$question_text, 
    				"is_correct" => $is_correct, 'snapshot'=>$snapshot, 'hints_used'=>$hints, 
    				"num_hints_used" => $no_hints, "onpage_question_num" => intval(@$_POST['current_question']),
    				"feedback" => @$_POST['feedback-'.$question_id],
    				"rating" => intval(@$_POST['question_rating_'.$question_id])),
    			array("%d","%d","%d","%d","%s","%f","%s", "%d", "%s", "%s", "%d", "%d", "%s", "%d"));    
    			$detail_id = $wpdb->insert_id;			
        }
        else {
				// don't remove the snapshot
				if(empty($snapshot) and !empty($detail->snapshot)) $snapshot = stripslashes($detail->snapshot);        	
        	
            $wpdb->query($wpdb->prepare("UPDATE ".WATUPRO_STUDENT_ANSWERS." SET
               answer=%s, points=%s, question_text=%s, is_correct=%d, snapshot=%s, hints_used = %s, 
               num_hints_used=%d, onpage_question_num=%d, feedback=%s, rating=%d
               WHERE id=%d", $answer, $points, $question_text, $is_correct, $snapshot, $hints, $no_hints,
               intval(@$_POST['current_question']), @$_POST['feedback-'.$question_id], intval(@$_POST['question_rating_'.$question_id]), $detail->ID ));
            $detail_id = $detail->ID;                 
        } 

That’s it.

Turn Multiple-Answer Gaps Into Drop-downs And Other Advanced Adjustments

You know that the Intelligence module of WatuPRO allows you to create “fill the gaps” questions. Each of the “gaps” (blanks) can have multiple correct answers when you use the following format:

The apple can be {{{green|red|yellow}}}

In the above example if the user fills green, or red, or yellow in the generated text field, their answer will be correct.

From version 5.0.2 the same format can be used for different purpose by selecting the following checkbox on the Edit Question page:

gaps-dropdownsWhen this is selected, all the gaps that have more than one answer within the question will be turned into drop-down selector. The drop-down selector will have one option for each answer given. The first answer that you have given is the only correct answer. But of course, it will not be shown first – the selections will be randomized so the user will not know which is the correct answer.

So if we use the above example, the correct answer will be “green” and red / yellow will not be correct.

This setting is per-question so it will affect all the blanks within the selected question.

Other Fill The Gaps Adjustments

You can create a “placeholder” for each regular gap (not for drop-downs) to give a hint or remind for the supported format in the gap like this:

One dollar has {{{100|placeholder="numbers only"}}} cents in it.

For gaps that allow multiple correct answers you can do the same – just make sure the placeholder is the last value:

A good apple color can be {{{green|red|yellow|placeholder="type color name"}}}.

On the WatuPRO Settings page you can define the width and height of the gaps. Sometimes you may need to apply specific CSS style to an individual gap. You can do this by passing an inline style as last answer for the gap (in case there is a placeholder, style should be after it). Examples:

One dollar has {{{100|placeholder="numbers only"|style="font-weight:bold;"}}} cents in it.

A good apple color can be {{{green|red|yellow|style="width:150px;"}}}.