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.