You can now duplicate your questions with your quizzes when duplicating!
+
Preview Mode
+
You can now preview your quiz while in the admin side by going to the new Preview tab on the Quiz Settings page!
-
New Question Type
-
You can now use the new Horizontal Multiple Response type to have your multiple reponse check boxes go horizontally instead of vertically.
+
Design Changes
+
This version made several design changes to various pages as we continue to redesign our plugin. We also made many design changes in our code!
+
+
We Are On GitHub Now
+
We have had several users ask for this so we thought we would try it out. We now love github! Be sure to make suggestions or contribute.
Our Premium Add-Ons!
We have several new premium add-ons in our WordPress Store: MailPoet Integration (subscribes users to your MailPoet list), MailChimp Integration (subscribes users to your Mailchimp list), Export Results (exports your quiz results), Extra Shortcodes (gives you extra shortcodes to use), User Dashboard (allow users to see the results from all the quizzes they have taken), and Advertisement Be Gone (gets rid of blue-border ads). Visit our WordPress Store for details!
-
(November 14, 2014)
+
(November 20, 2014)
-
* Minor Backend Change To Quiz Validation
-
* Disabled Enter Key On Quiz
-
* Minor Bug Fixes
+
* Added Preview Mode (Beta)
+
* Several Design Changes To Quizzes Page
+
* Minor Design Changes To Quiz Settings Page
+
* Added Completion Time To Quiz Results Page
+
* Added Time Taken To Quiz Result Details Page
+
* Created New Hook On Quiz Settings Page
+
* Broke Apart Quiz Settings Backend Into Smaller Functions That Hook Into New Hook
+
* Created New Backend Alert Manager Class To Replace Archaic Old Error System
@@ -146,4 +154,4 @@ function mlw_qmn_setTab(tab) {
\ No newline at end of file
+?>
diff --git a/includes/mlw_quiz_admin.php b/includes/mlw_quiz_admin.php
index 46417c78c..5eeb27388 100644
--- a/includes/mlw_quiz_admin.php
+++ b/includes/mlw_quiz_admin.php
@@ -9,13 +9,8 @@
function mlw_generate_quiz_admin()
{
global $wpdb;
+ global $mlwQmnAlertManager;
$table_name = $wpdb->prefix . "mlw_quizzes";
- $hasCreatedQuiz = false;
- $hasDeletedQuiz = false;
- $hasUpdatedQuizName = false;
- $hasDuplicatedQuiz = false;
- $mlw_qmn_isQueryError = false;
- $mlw_qmn_error_code = '0';
//Create new quiz
if ( isset( $_POST["create_quiz"] ) && $_POST["create_quiz"] == "confirmation" )
@@ -77,7 +72,7 @@ function mlw_generate_quiz_admin()
$results = $wpdb->query( $insert );
if ($results != false)
{
- $hasCreatedQuiz = true;
+ $mlwQmnAlertManager->newAlert('Your new quiz has been created successfully. To begin editing your quiz, click the Edit link on the new quiz.', 'success');
//Insert Action Into Audit Trail
global $current_user;
get_currentuserinfo();
@@ -89,8 +84,7 @@ function mlw_generate_quiz_admin()
}
else
{
- $mlw_qmn_error_code = '0001';
- $mlw_qmn_isQueryError = true;
+ $mlwQmnAlertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0001.', 'error');
}
}
@@ -109,7 +103,7 @@ function mlw_generate_quiz_admin()
$delete_question_results = $wpdb->query( $update );
if ($results != false)
{
- $hasDeletedQuiz = true;
+ $mlwQmnAlertManager->newAlert('Your quiz has been deleted successfully.', 'success');
//Insert Action Into Audit Trail
global $current_user;
@@ -122,8 +116,7 @@ function mlw_generate_quiz_admin()
}
else
{
- $mlw_qmn_error_code = '0002';
- $mlw_qmn_isQueryError = true;
+ $mlwQmnAlertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0002.', 'error');
}
}
@@ -137,7 +130,7 @@ function mlw_generate_quiz_admin()
$results = $wpdb->query( $mlw_update_quiz_table );
if ($results != false)
{
- $hasUpdatedQuizName = true;
+ $mlwQmnAlertManager->newAlert('Your quiz name has been updated successfully.', 'success');
//Insert Action Into Audit Trail
global $current_user;
@@ -150,8 +143,7 @@ function mlw_generate_quiz_admin()
}
else
{
- $mlw_qmn_error_code = '0003';
- $mlw_qmn_isQueryError = true;
+ $mlwQmnAlertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0003.', 'error');
}
}
@@ -265,6 +257,7 @@ function mlw_generate_quiz_admin()
//$results = $wpdb->query( "INSERT INTO ".$table_name." (quiz_id, quiz_name, message_before, message_after, message_comment, message_end_template, user_email_template, admin_email_template, submit_button_text, name_field_text, business_field_text, email_field_text, phone_field_text, comment_field_text, email_from_text, question_answer_template, leaderboard_template, system, randomness_order, loggedin_user_contact, show_score, send_user_email, send_admin_email, contact_info_location, user_name, user_comp, user_email, user_phone, admin_email, comment_section, question_from_total, total_user_tries, total_user_tries_text, certificate_template, social_media, social_media_text, pagination, pagination_text, timer_limit, quiz_stye, question_numbering, quiz_views, quiz_taken, deleted) VALUES (NULL , '".$mlw_duplicate_quiz_name."' , '".$mlw_qmn_duplicate_data->message_before."', '".$mlw_qmn_duplicate_data->message_after."', '".$mlw_qmn_duplicate_data->message_comment."', '".$mlw_qmn_duplicate_data->message_end_template."', '".$mlw_qmn_duplicate_data->user_email_template."', '".$mlw_qmn_duplicate_data->admin_email_template."', '".$mlw_qmn_duplicate_data->submit_button_text."', '".$mlw_qmn_duplicate_data->name_field_text."', '".$mlw_qmn_duplicate_data->business_field_text."', '".$mlw_qmn_duplicate_data->email_field_text."', '".$mlw_qmn_duplicate_data->phone_field_text."', '".$mlw_qmn_duplicate_data->comment_field_text."', '".$mlw_qmn_duplicate_data->email_from_text."', '".$mlw_qmn_duplicate_data->question_answer_template."', '".$mlw_qmn_duplicate_data->leaderboard_template."', ".$mlw_qmn_duplicate_data->system.", ".$mlw_qmn_duplicate_data->randomness_order.", ".$mlw_qmn_duplicate_data->loggedin_user_contact.", ".$mlw_qmn_duplicate_data->show_score.", ".$mlw_qmn_duplicate_data->send_user_email.", ".$mlw_qmn_duplicate_data->send_admin_email.", ".$mlw_qmn_duplicate_data->contact_info_location.", ".$mlw_qmn_duplicate_data->user_name.", ".$mlw_qmn_duplicate_data->user_comp.", ".$mlw_qmn_duplicate_data->user_email.", ".$mlw_qmn_duplicate_data->user_phone.", '".get_option( 'admin_email', 'Enter email' )."', ".$mlw_qmn_duplicate_data->comment_section.", ".$mlw_qmn_duplicate_data->question_from_total.", ".$mlw_qmn_duplicate_data->total_user_tries.", '".$mlw_qmn_duplicate_data->total_user_tries_text."', '".$mlw_qmn_duplicate_data->certificate_template."', ".$mlw_qmn_duplicate_data->social_media.", '".$mlw_qmn_duplicate_data->social_media_text."', ".$mlw_qmn_duplicate_data->pagination.", '".$mlw_qmn_duplicate_data->pagination_text."', ".$mlw_qmn_duplicate_data->timer_limit.", '".$mlw_qmn_duplicate_data->quiz_stye."', ".$mlw_qmn_duplicate_data->question_numbering.", 0, 0, 0)" );
if ($results != false)
{
+ $mlwQmnAlertManager->newAlert('Your quiz has been duplicated successfully.', 'success');
$hasDuplicatedQuiz = true;
//Insert Action Into Audit Trail
@@ -278,8 +271,7 @@ function mlw_generate_quiz_admin()
}
else
{
- $mlw_qmn_error_code = '0011';
- $mlw_qmn_isQueryError = true;
+ $mlwQmnAlertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0011.', 'error');
}
if (isset($_POST["duplicate_questions"]))
{
@@ -342,8 +334,7 @@ function mlw_generate_quiz_admin()
);
if ($question_results == false)
{
- $mlw_qmn_error_code = '0011';
- $mlw_qmn_isQueryError = true;
+ $mlwQmnAlertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0020.', 'error');
}
}
}
@@ -386,30 +377,8 @@ function mlw_generate_quiz_admin()
var $j = jQuery.noConflict();
// increase the default animation speed to exaggerate the effect
$j.fx.speeds._default = 1000;
- $j(function() {
- $j('#dialog').dialog({
- autoOpen: false,
- show: 'blind',
- hide: 'explode',
- buttons: {
- Ok: function() {
- $j(this).dialog('close');
- }
- }
- });
-
- $j('#opener').click(function() {
- $j('#dialog').dialog('open');
- return false;
- } );
- });
$j(function() {
$j("#prev_page, #next_page").button();
- $j("#new_quiz_button, #new_quiz_button_two").button({
- icons: {
- primary: "ui-icon-circle-plus"
- }
- });
});
$j(function() {
$j('#new_quiz_dialog').dialog({
@@ -490,59 +459,26 @@ function duplicateQuiz(id, quizName){
cursor:hand;
}
-
This page shows all of the quizzes currently on your website.
-
The table shows the quiz id, the name of your quiz, the shortcode to use on your post or page to add the quiz, the shortcode to use on your post or page to add the leaderboard, the amount of views the quiz has had, and the amount of times the quiz was finished
-
To create a new quiz, click the Create New Quiz button and fill out the name.
-
To edit a quiz, click the Edit link underneath the name of the quiz.
-
To edit a quiz's name, click the Edit Name link next to the name of the quiz.
-
To delete a quiz, click the Delete link underneath the name of the quiz.
-
To view the results of a quiz, click the Results link underneath the name of the quiz.
+ query( $wpdb->prepare( "UPDATE " . $wpdb->prefix . "mlw_quizzes SET certificate_template=%s, last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=%d", $mlw_certificate_serialized, $mlw_certificate_id ) );
+
+
+ if ($mlw_certificate_sql_results != false)
+ {
+ $mlwQmnAlertManager->newAlert('The certificate has been updated successfully.', 'success');
+
+ //Insert Action Into Audit Trail
+ global $current_user;
+ get_currentuserinfo();
+ $table_name = $wpdb->prefix . "mlw_qm_audit_trail";
+ $insert = "INSERT INTO " . $table_name .
+ "(trail_id, action_user, action, time) " .
+ "VALUES (NULL , '" . $current_user->display_name . "' , 'Certificate Options Have Been Edited For Quiz Number ".$mlw_certificate_id."' , '" . date("h:i:s A m/d/Y") . "')";
+ $results = $wpdb->query( $insert );
+ }
+ else
+ {
+ $mlwQmnAlertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0012.', 'error');
+ }
+ }
+ if (isset($_GET["quiz_id"]))
+ {
+ $table_name = $wpdb->prefix . "mlw_quizzes";
+ $mlw_quiz_options = $wpdb->get_row($wpdb->prepare("SELECT * FROM $table_name WHERE quiz_id=%d LIMIT 1", $_GET["quiz_id"]));
+ }
+
+ //Load Certificate Options Variables
+ $mlw_certificate_options = @unserialize($mlw_quiz_options->certificate_template);
+ if (!is_array($mlw_certificate_options)) {
+ // something went wrong, initialize to empty array
+ $mlw_certificate_options = array('Enter title here', 'Enter text here', '', '', 1);
+ }
+ ?>
+
+
Quiz Certificate (Beta)
Enter in your text here to fill in the certificate for this quiz. Be sure to enter in the link variable into the templates on the Quiz Text tab so the user can access the certificate.
These fields cannot contain HTML.
@@ -2004,7 +1574,129 @@ function mlw_qmn_theme(theme)
-
+ get_var( $wpdb->prepare( "SELECT user_email_template FROM ".$wpdb->prefix."mlw_quizzes WHERE quiz_id=%d", $mlw_qmn_add_email_id ) );
+
+ //Load user email and check if it is array already. If not, turn it into one
+ $mlw_qmn_email_array = @unserialize($mlw_qmn_user_email);
+ if (is_array($mlw_qmn_email_array))
+ {
+ $mlw_new_landing_array = array(0, 100, 'Enter Your Text Here', 'Quiz Results For %QUIZ_NAME%');
+ array_unshift($mlw_qmn_email_array , $mlw_new_landing_array);
+ $mlw_qmn_email_array = serialize($mlw_qmn_email_array);
+
+ }
+ else
+ {
+ $mlw_qmn_email_array = array(array(0, 0, $mlw_qmn_user_email, 'Quiz Results For %QUIZ_NAME%'));
+ $mlw_new_landing_array = array(0, 100, 'Enter Your Text Here', 'Quiz Results For %QUIZ_NAME%');
+ array_unshift($mlw_qmn_email_array , $mlw_new_landing_array);
+ $mlw_qmn_email_array = serialize($mlw_qmn_email_array);
+ }
+ //Update message_after with new array then check to see if worked
+ $mlw_new_email_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET user_email_template='%s', last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=%d", $mlw_qmn_email_array, $mlw_qmn_add_email_id ) );
+ if ($mlw_new_email_results != false)
+ {
+ $mlwQmnAlertManager->newAlert('The email has been added successfully.', 'success');
+
+ //Insert Action Into Audit Trail
+ global $current_user;
+ get_currentuserinfo();
+ $table_name = $wpdb->prefix . "mlw_qm_audit_trail";
+ $insert = "INSERT INTO " . $table_name .
+ "(trail_id, action_user, action, time) " .
+ "VALUES (NULL , '" . $current_user->display_name . "' , 'New User Email Has Been Created For Quiz Number ".$mlw_qmn_add_email_id."' , '" . date("h:i:s A m/d/Y") . "')";
+ $results = $wpdb->query( $insert );
+ }
+ else
+ {
+ $mlwQmnAlertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0016.', 'error');
+ }
+ }
+
+ //Check to save email templates
+ if (isset($_POST["mlw_save_email_template"]) && $_POST["mlw_save_email_template"] == "confirmation")
+ {
+ //Function Variables
+ $mlw_qmn_email_id = intval($_POST["mlw_email_quiz_id"]);
+ $mlw_qmn_email_template_total = intval($_POST["mlw_email_template_total"]);
+ $mlw_qmn_admin_email = htmlspecialchars(stripslashes($_POST["mlw_quiz_admin_email_template"]), ENT_QUOTES);
+
+ //Create new array
+ $i = 1;
+ $mlw_qmn_new_email_array = array();
+ while ($i <= $mlw_qmn_email_template_total)
+ {
+ if ($_POST["user_email_".$i] != "Delete")
+ {
+ $mlw_qmn_email_each = array(intval($_POST["user_email_begin_".$i]), intval($_POST["user_email_end_".$i]), htmlspecialchars(stripslashes($_POST["user_email_".$i]), ENT_QUOTES), htmlspecialchars(stripslashes($_POST["user_email_subject_".$i]), ENT_QUOTES));
+ $mlw_qmn_new_email_array[] = $mlw_qmn_email_each;
+ }
+ $i++;
+ }
+ $mlw_qmn_new_email_array = serialize($mlw_qmn_new_email_array);
+ $mlw_new_email_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET user_email_template='%s', admin_email_template='%s', last_activity='".date("Y-m-d H:i:s")."' WHERE quiz_id=%d", $mlw_qmn_new_email_array, $mlw_qmn_admin_email, $mlw_qmn_email_id ) );
+ if ($mlw_new_email_results != false)
+ {
+ $mlwQmnAlertManager->newAlert('The email has been updated successfully.', 'success');
+
+ //Insert Action Into Audit Trail
+ global $current_user;
+ get_currentuserinfo();
+ $table_name = $wpdb->prefix . "mlw_qm_audit_trail";
+ $insert = "INSERT INTO " . $table_name .
+ "(trail_id, action_user, action, time) " .
+ "VALUES (NULL , '" . $current_user->display_name . "' , 'Email Templates Have Been Saved For Quiz Number ".$mlw_qmn_email_id."' , '" . date("h:i:s A m/d/Y") . "')";
+ $results = $wpdb->query( $insert );
+ }
+ else
+ {
+ $mlwQmnAlertManager->newAlert('There has been an error in this action. Please share this with the developer. Error Code: 0017.', 'error');
+ }
+ }
+
+ if (isset($_GET["quiz_id"]))
+ {
+ $table_name = $wpdb->prefix . "mlw_quizzes";
+ $mlw_quiz_options = $wpdb->get_row($wpdb->prepare("SELECT * FROM $table_name WHERE quiz_id=%d LIMIT 1", $_GET["quiz_id"]));
+ }
+
+ //Load Email Templates
+ $mlw_qmn_user_email_array = @unserialize($mlw_quiz_options->user_email_template);
+ if (!is_array($mlw_qmn_user_email_array)) {
+ // something went wrong, initialize to empty array
+ $mlw_qmn_user_email_array = array(array(0, 0, $mlw_quiz_options->user_email_template, 'Quiz Results For %QUIZ_NAME%'));
+ }
+ ?>
+
+
+
Template Variables
@@ -2046,7 +1738,6 @@ function mlw_qmn_theme(theme)
-