Version Description
(April 1, 2018) = * Makes minor style adjustments * Adds additional hook to admin results details page * Modifies a few error messages
Download this release
Release Info
Developer | fpcorso |
Plugin | Quiz And Survey Master (Formerly Quiz Master Next) |
Version | 5.2.2 |
Comparing to | |
See all releases |
Code changes from version 5.2.1 to 5.2.2
- js/qmn_quiz.js +39 -35
- mlw_quizmaster2.php +5 -5
- php/admin/admin-results-details-page.php +44 -31
- php/admin/admin-results-page.php +11 -8
- php/admin/options-page-email-tab.php +9 -7
- php/classes/class-qmn-tracking.php +33 -26
- readme.txt +6 -1
js/qmn_quiz.js
CHANGED
@@ -10,13 +10,15 @@ var QSM;
|
|
10 |
(function ($) {
|
11 |
QSM = {
|
12 |
init: function() {
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
20 |
},
|
21 |
|
22 |
/**
|
@@ -300,38 +302,40 @@ function qmnDisplayResults( results, quiz_form_id, $container ) {
|
|
300 |
}
|
301 |
|
302 |
function qmnInit() {
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
if ( answer[
|
314 |
-
|
|
|
|
|
315 |
}
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
}
|
320 |
-
}
|
321 |
-
}
|
322 |
});
|
323 |
-
}
|
324 |
-
}
|
325 |
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
|
333 |
-
|
334 |
-
|
|
|
335 |
}
|
336 |
}
|
337 |
}
|
10 |
(function ($) {
|
11 |
QSM = {
|
12 |
init: function() {
|
13 |
+
if (qmn_quiz_data) {
|
14 |
+
_.each( qmn_quiz_data, function( quiz ) {
|
15 |
+
quizID = parseInt( quiz.quiz_id );
|
16 |
+
QSM.initPagination( quizID );
|
17 |
+
if ( quiz.hasOwnProperty( 'timer_limit' ) && 0 != quiz.timer_limit ) {
|
18 |
+
QSM.initTimer( quizID );
|
19 |
+
}
|
20 |
+
});
|
21 |
+
}
|
22 |
},
|
23 |
|
24 |
/**
|
302 |
}
|
303 |
|
304 |
function qmnInit() {
|
305 |
+
if (qmn_quiz_data) {
|
306 |
+
for ( var key in qmn_quiz_data ) {
|
307 |
+
if ( qmn_quiz_data[key].ajax_show_correct === '1' ) {
|
308 |
+
jQuery( '#quizForm' + qmn_quiz_data[key].quiz_id + ' .qmn_quiz_radio').change(function() {
|
309 |
+
var chosen_answer = jQuery(this).val();
|
310 |
+
var question_id = jQuery(this).attr('name').replace(/question/i,'');
|
311 |
+
var chosen_id = jQuery(this).attr('id');
|
312 |
+
jQuery.each( qmn_quiz_data[key].question_list, function( i, value ) {
|
313 |
+
if ( question_id == value.question_id ) {
|
314 |
+
jQuery.each( value.answers, function(j, answer ) {
|
315 |
+
if ( answer[0] === chosen_answer ) {
|
316 |
+
if ( answer[2] !== 1) {
|
317 |
+
jQuery( '#'+chosen_id ).parent().addClass( "qmn_incorrect_answer" );
|
318 |
+
}
|
319 |
}
|
320 |
+
if ( answer[2] === 1) {
|
321 |
+
jQuery( ':radio[name=question'+question_id+'][value="'+answer[0]+'"]' ).parent().addClass( "qmn_correct_answer" );
|
322 |
+
}
|
323 |
+
});
|
324 |
+
}
|
325 |
+
});
|
326 |
});
|
327 |
+
}
|
|
|
328 |
|
329 |
+
if ( qmn_quiz_data[key].disable_answer === '1' ) {
|
330 |
+
jQuery( '#quizForm' + qmn_quiz_data[key].quiz_id + ' .qmn_quiz_radio').change(function() {
|
331 |
+
var radio_group = jQuery(this).attr('name');
|
332 |
+
jQuery('input[type=radio][name='+radio_group+']').prop('disabled',true);
|
333 |
+
});
|
334 |
+
}
|
335 |
|
336 |
+
if ( qmn_quiz_data[key].hasOwnProperty('pagination') ) {
|
337 |
+
qmnInitPagination( qmn_quiz_data[key].quiz_id );
|
338 |
+
}
|
339 |
}
|
340 |
}
|
341 |
}
|
mlw_quizmaster2.php
CHANGED
@@ -2,14 +2,14 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Quiz And Survey Master
|
4 |
* Description: Easily and quickly add quizzes and surveys to your website.
|
5 |
-
* Version: 5.2.
|
6 |
* Author: Frank Corso
|
7 |
* Author URI: https://www.quizandsurveymaster.com/
|
8 |
* Plugin URI: https://www.quizandsurveymaster.com/
|
9 |
* Text Domain: quiz-master-next
|
10 |
*
|
11 |
* @author Frank Corso
|
12 |
-
* @version 5.2.
|
13 |
* @package QSM
|
14 |
*/
|
15 |
|
@@ -33,7 +33,7 @@ class MLWQuizMasterNext {
|
|
33 |
* @var string
|
34 |
* @since 4.0.0
|
35 |
*/
|
36 |
-
public $version = '5.2.
|
37 |
|
38 |
/**
|
39 |
* QSM Alert Manager Object
|
@@ -263,7 +263,7 @@ class MLWQuizMasterNext {
|
|
263 |
add_menu_page( 'Quiz And Survey Master', __( 'Quizzes/Surveys', 'quiz-master-next' ), 'moderate_comments', __FILE__, 'qsm_generate_quizzes_surveys_page', 'dashicons-feedback' );
|
264 |
add_submenu_page( __FILE__, __( 'Settings', 'quiz-master-next' ), __( 'Settings', 'quiz-master-next' ), 'moderate_comments', 'mlw_quiz_options', 'qsm_generate_quiz_options' );
|
265 |
add_submenu_page( __FILE__, __( 'Results', 'quiz-master-next' ), __( 'Results', 'quiz-master-next' ), 'moderate_comments', 'mlw_quiz_results', 'qsm_generate_admin_results_page' );
|
266 |
-
add_submenu_page( __FILE__, __( 'Result Details', 'quiz-master-next' ), __( 'Result Details', 'quiz-master-next' ), 'moderate_comments', '
|
267 |
add_submenu_page( __FILE__, __( 'Settings', 'quiz-master-next' ), __( 'Settings', 'quiz-master-next' ), 'manage_options', 'qmn_global_settings', array( 'QMNGlobalSettingsPage', 'display_page' ) );
|
268 |
add_submenu_page( __FILE__, __( 'Tools', 'quiz-master-next' ), __( 'Tools', 'quiz-master-next' ), 'manage_options', 'mlw_quiz_tools', 'mlw_generate_quiz_tools' );
|
269 |
add_submenu_page( __FILE__, __( 'Stats', 'quiz-master-next' ), __( 'Stats', 'quiz-master-next' ), 'moderate_comments', 'qmn_stats', 'qmn_generate_stats_page' );
|
@@ -291,7 +291,7 @@ class MLWQuizMasterNext {
|
|
291 |
public function admin_head() {
|
292 |
remove_submenu_page( 'index.php', 'qsm_about' );
|
293 |
remove_submenu_page( 'quiz-master-next/mlw_quizmaster2.php', 'mlw_quiz_options' );
|
294 |
-
remove_submenu_page( 'quiz-master-next/mlw_quizmaster2.php', '
|
295 |
}
|
296 |
}
|
297 |
|
2 |
/**
|
3 |
* Plugin Name: Quiz And Survey Master
|
4 |
* Description: Easily and quickly add quizzes and surveys to your website.
|
5 |
+
* Version: 5.2.2
|
6 |
* Author: Frank Corso
|
7 |
* Author URI: https://www.quizandsurveymaster.com/
|
8 |
* Plugin URI: https://www.quizandsurveymaster.com/
|
9 |
* Text Domain: quiz-master-next
|
10 |
*
|
11 |
* @author Frank Corso
|
12 |
+
* @version 5.2.2
|
13 |
* @package QSM
|
14 |
*/
|
15 |
|
33 |
* @var string
|
34 |
* @since 4.0.0
|
35 |
*/
|
36 |
+
public $version = '5.2.2';
|
37 |
|
38 |
/**
|
39 |
* QSM Alert Manager Object
|
263 |
add_menu_page( 'Quiz And Survey Master', __( 'Quizzes/Surveys', 'quiz-master-next' ), 'moderate_comments', __FILE__, 'qsm_generate_quizzes_surveys_page', 'dashicons-feedback' );
|
264 |
add_submenu_page( __FILE__, __( 'Settings', 'quiz-master-next' ), __( 'Settings', 'quiz-master-next' ), 'moderate_comments', 'mlw_quiz_options', 'qsm_generate_quiz_options' );
|
265 |
add_submenu_page( __FILE__, __( 'Results', 'quiz-master-next' ), __( 'Results', 'quiz-master-next' ), 'moderate_comments', 'mlw_quiz_results', 'qsm_generate_admin_results_page' );
|
266 |
+
add_submenu_page( __FILE__, __( 'Result Details', 'quiz-master-next' ), __( 'Result Details', 'quiz-master-next' ), 'moderate_comments', 'qsm_quiz_result_details', 'qsm_generate_result_details' );
|
267 |
add_submenu_page( __FILE__, __( 'Settings', 'quiz-master-next' ), __( 'Settings', 'quiz-master-next' ), 'manage_options', 'qmn_global_settings', array( 'QMNGlobalSettingsPage', 'display_page' ) );
|
268 |
add_submenu_page( __FILE__, __( 'Tools', 'quiz-master-next' ), __( 'Tools', 'quiz-master-next' ), 'manage_options', 'mlw_quiz_tools', 'mlw_generate_quiz_tools' );
|
269 |
add_submenu_page( __FILE__, __( 'Stats', 'quiz-master-next' ), __( 'Stats', 'quiz-master-next' ), 'moderate_comments', 'qmn_stats', 'qmn_generate_stats_page' );
|
291 |
public function admin_head() {
|
292 |
remove_submenu_page( 'index.php', 'qsm_about' );
|
293 |
remove_submenu_page( 'quiz-master-next/mlw_quizmaster2.php', 'mlw_quiz_options' );
|
294 |
+
remove_submenu_page( 'quiz-master-next/mlw_quizmaster2.php', 'qsm_quiz_result_details' );
|
295 |
}
|
296 |
}
|
297 |
|
php/admin/admin-results-details-page.php
CHANGED
@@ -6,7 +6,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
|
6 |
* @return type void
|
7 |
* @since 4.4.0
|
8 |
*/
|
9 |
-
function
|
10 |
if ( ! current_user_can( 'moderate_comments' ) ) {
|
11 |
return;
|
12 |
}
|
@@ -23,7 +23,7 @@ function mlw_generate_result_details() {
|
|
23 |
if ( $active_tab == $tab['slug'] ) {
|
24 |
$active_class = 'nav-tab-active';
|
25 |
}
|
26 |
-
echo "<a href=\"?page=
|
27 |
}
|
28 |
?>
|
29 |
</h2>
|
@@ -48,20 +48,24 @@ function mlw_generate_result_details() {
|
|
48 |
* @return void
|
49 |
* @since 4.4.0
|
50 |
*/
|
51 |
-
function
|
52 |
-
|
53 |
-
$mlw_result_id = intval( $_GET["result_id"] );
|
54 |
global $wpdb;
|
55 |
-
$mlw_results_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "mlw_results WHERE result_id=%d", $mlw_result_id ) );
|
56 |
|
57 |
-
$
|
58 |
-
$
|
|
|
|
|
|
|
|
|
59 |
if ( ! is_null( $previous_results ) && $previous_results ) {
|
60 |
-
echo "<a class='button' href=\"?page=
|
61 |
}
|
62 |
if ( ! is_null( $next_results ) && $next_results ) {
|
63 |
-
echo " <a class='button' href=\"?page=
|
64 |
}
|
|
|
|
|
65 |
$settings = (array) get_option( 'qmn-settings' );
|
66 |
if ( isset( $settings['results_details_template'] ) ) {
|
67 |
$template = htmlspecialchars_decode( $settings['results_details_template'], ENT_QUOTES );
|
@@ -79,13 +83,15 @@ function qmn_generate_results_details_tab() {
|
|
79 |
<p>The answers were as follows:</p>
|
80 |
%QUESTIONS_ANSWERS%";
|
81 |
}
|
82 |
-
|
83 |
-
|
|
|
|
|
84 |
if ( ! isset( $results["contact"] ) ) {
|
85 |
$results["contact"] = array();
|
86 |
}
|
87 |
} else {
|
88 |
-
$template = str_replace( "%QUESTIONS_ANSWERS%" , $
|
89 |
$template = str_replace( "%TIMER%" , '', $template);
|
90 |
$template = str_replace( "%COMMENT_SECTION%" , '', $template);
|
91 |
$results = array(
|
@@ -95,28 +101,35 @@ function qmn_generate_results_details_tab() {
|
|
95 |
'contact' => array()
|
96 |
);
|
97 |
}
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
'
|
102 |
-
'
|
103 |
-
'
|
104 |
-
'
|
105 |
-
'
|
106 |
-
'
|
|
|
|
|
107 |
'timer' => $results[0],
|
108 |
-
'time_taken' => $
|
109 |
-
'total_points' => $
|
110 |
-
'total_score' => $
|
111 |
-
'total_correct' => $
|
112 |
-
'total_questions' => $
|
113 |
'comments' => $results[2],
|
114 |
'question_answers_array' => $results[1],
|
115 |
'contact' => $results["contact"]
|
116 |
);
|
117 |
-
|
|
|
|
|
118 |
$template = str_replace( "\n" , "<br>", $template );
|
119 |
echo $template;
|
|
|
|
|
|
|
120 |
}
|
121 |
|
122 |
|
@@ -126,9 +139,9 @@ function qmn_generate_results_details_tab() {
|
|
126 |
* @return void
|
127 |
* @since 4.4.0
|
128 |
*/
|
129 |
-
function
|
130 |
global $mlwQuizMasterNext;
|
131 |
-
$mlwQuizMasterNext->pluginHelper->register_results_settings_tab( __( "Results", 'quiz-master-next' ), "
|
132 |
}
|
133 |
-
add_action( "plugins_loaded", '
|
134 |
?>
|
6 |
* @return type void
|
7 |
* @since 4.4.0
|
8 |
*/
|
9 |
+
function qsm_generate_result_details() {
|
10 |
if ( ! current_user_can( 'moderate_comments' ) ) {
|
11 |
return;
|
12 |
}
|
23 |
if ( $active_tab == $tab['slug'] ) {
|
24 |
$active_class = 'nav-tab-active';
|
25 |
}
|
26 |
+
echo "<a href=\"?page=qsm_quiz_result_details&&result_id=" . intval( $_GET["result_id"] ) . "&&tab=" . $tab['slug'] . "\" class=\"nav-tab $active_class\">" . $tab['title'] . "</a>";
|
27 |
}
|
28 |
?>
|
29 |
</h2>
|
48 |
* @return void
|
49 |
* @since 4.4.0
|
50 |
*/
|
51 |
+
function qsm_generate_results_details_tab() {
|
52 |
+
|
|
|
53 |
global $wpdb;
|
|
|
54 |
|
55 |
+
$result_id = intval( $_GET["result_id"] );
|
56 |
+
$results_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}mlw_results WHERE result_id = %d", $result_id ) );
|
57 |
+
$previous_results = $wpdb->get_var( "SELECT result_id FROM {$wpdb->prefix}mlw_results WHERE result_id = (SELECT MAX(result_id) FROM {$wpdb->prefix}mlw_results WHERE deleted = 0 AND result_id < $result_id)" );
|
58 |
+
$next_results = $wpdb->get_var( "SELECT result_id FROM {$wpdb->prefix}mlw_results WHERE result_id = (SELECT MIN(result_id) FROM {$wpdb->prefix}mlw_results WHERE deleted = 0 AND result_id > $result_id)" );
|
59 |
+
|
60 |
+
// If there is previous or next results, show buttons.
|
61 |
if ( ! is_null( $previous_results ) && $previous_results ) {
|
62 |
+
echo "<a class='button' href=\"?page=qsm_quiz_result_details&&result_id=" . intval( $previous_results ) . "\" >View Previous Results</a> ";
|
63 |
}
|
64 |
if ( ! is_null( $next_results ) && $next_results ) {
|
65 |
+
echo " <a class='button' href=\"?page=qsm_quiz_result_details&&result_id=" . intval( $next_results ) . "\" >View Next Results</a>";
|
66 |
}
|
67 |
+
|
68 |
+
// Get template for admin results.
|
69 |
$settings = (array) get_option( 'qmn-settings' );
|
70 |
if ( isset( $settings['results_details_template'] ) ) {
|
71 |
$template = htmlspecialchars_decode( $settings['results_details_template'], ENT_QUOTES );
|
83 |
<p>The answers were as follows:</p>
|
84 |
%QUESTIONS_ANSWERS%";
|
85 |
}
|
86 |
+
|
87 |
+
// Prepare responses array.
|
88 |
+
if ( is_serialized( $results_data->quiz_results ) && is_array( @unserialize( $results_data->quiz_results ) ) ) {
|
89 |
+
$results = unserialize($results_data->quiz_results);
|
90 |
if ( ! isset( $results["contact"] ) ) {
|
91 |
$results["contact"] = array();
|
92 |
}
|
93 |
} else {
|
94 |
+
$template = str_replace( "%QUESTIONS_ANSWERS%" , $results_data->quiz_results, $template);
|
95 |
$template = str_replace( "%TIMER%" , '', $template);
|
96 |
$template = str_replace( "%COMMENT_SECTION%" , '', $template);
|
97 |
$results = array(
|
101 |
'contact' => array()
|
102 |
);
|
103 |
}
|
104 |
+
|
105 |
+
// Prepare full results array.
|
106 |
+
$results_array = array(
|
107 |
+
'quiz_id' => $results_data->quiz_id,
|
108 |
+
'quiz_name' => $results_data->quiz_name,
|
109 |
+
'quiz_system' => $results_data->quiz_system,
|
110 |
+
'user_name' => $results_data->name,
|
111 |
+
'user_business' => $results_data->business,
|
112 |
+
'user_email' => $results_data->email,
|
113 |
+
'user_phone' => $results_data->phone,
|
114 |
+
'user_id' => $results_data->user,
|
115 |
'timer' => $results[0],
|
116 |
+
'time_taken' => $results_data->time_taken,
|
117 |
+
'total_points' => $results_data->point_score,
|
118 |
+
'total_score' => $results_data->correct_score,
|
119 |
+
'total_correct' => $results_data->correct,
|
120 |
+
'total_questions' => $results_data->total,
|
121 |
'comments' => $results[2],
|
122 |
'question_answers_array' => $results[1],
|
123 |
'contact' => $results["contact"]
|
124 |
);
|
125 |
+
|
126 |
+
// Pass through template variable filter
|
127 |
+
$template = apply_filters( 'mlw_qmn_template_variable_results_page', $template, $results_array );
|
128 |
$template = str_replace( "\n" , "<br>", $template );
|
129 |
echo $template;
|
130 |
+
|
131 |
+
// Hook for below admin results
|
132 |
+
do_action( 'qsm_below_admin_results', $results_array );
|
133 |
}
|
134 |
|
135 |
|
139 |
* @return void
|
140 |
* @since 4.4.0
|
141 |
*/
|
142 |
+
function qsm_results_details_tab() {
|
143 |
global $mlwQuizMasterNext;
|
144 |
+
$mlwQuizMasterNext->pluginHelper->register_results_settings_tab( __( "Results", 'quiz-master-next' ), "qsm_generate_results_details_tab" );
|
145 |
}
|
146 |
+
add_action( "plugins_loaded", 'qsm_results_details_tab' );
|
147 |
?>
|
php/admin/admin-results-page.php
CHANGED
@@ -95,14 +95,17 @@ function qsm_results_overview_tab_content() {
|
|
95 |
array( '%d' )
|
96 |
);
|
97 |
|
98 |
-
if ( $results ) {
|
99 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
$mlwQuizMasterNext->audit_manager->new_audit( "Results Has Been Deleted From: $mlw_delete_results_name" );
|
101 |
-
|
102 |
-
else
|
103 |
-
{
|
104 |
-
$mlwQuizMasterNext->alertManager->newAlert(sprintf(__('There has been an error in this action. Please share this with the developer. Error Code: %s', 'quiz-master-next'), '0021'), 'error');
|
105 |
-
$mlwQuizMasterNext->log_manager->add("Error 0021", $wpdb->last_error.' from '.$wpdb->last_query, 0, 'error');
|
106 |
}
|
107 |
}
|
108 |
|
@@ -345,7 +348,7 @@ function qsm_results_overview_tab_content() {
|
|
345 |
|
346 |
$quotes_list .= "<tr{$alternate}>";
|
347 |
$quotes_list .= "<td><input type='checkbox' class='qmn_delete_checkbox' name='delete_results[]' value='".$mlw_quiz_info->result_id. "' /></td>";
|
348 |
-
$quotes_list .= "<td><span style='color:green;font-size:16px;'><a href='admin.php?page=
|
349 |
$quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_name . "</span></td>";
|
350 |
if ($mlw_quiz_info->quiz_system == 0)
|
351 |
{
|
95 |
array( '%d' )
|
96 |
);
|
97 |
|
98 |
+
if ( false === $results ) {
|
99 |
+
$error = $wpdb->last_error;
|
100 |
+
if ( empty( $error ) ) {
|
101 |
+
$error = __( 'Unknown error', 'quiz-master-next' );
|
102 |
+
}
|
103 |
+
$mlwQuizMasterNext->alertManager->newAlert( sprintf( __( 'There was an error when deleting this result. Error from WordPress: %s', 'quiz-master-next' ), $error ), 'error' );
|
104 |
+
$mlwQuizMasterNext->log_manager->add( 'Error deleting result', "Tried {$wpdb->last_query} but got $error.", 0, 'error' );
|
105 |
+
} else {
|
106 |
+
$mlwQuizMasterNext->alertManager->newAlert( __('Your results has been deleted successfully.','quiz-master-next'), 'success');
|
107 |
$mlwQuizMasterNext->audit_manager->new_audit( "Results Has Been Deleted From: $mlw_delete_results_name" );
|
108 |
+
|
|
|
|
|
|
|
|
|
109 |
}
|
110 |
}
|
111 |
|
348 |
|
349 |
$quotes_list .= "<tr{$alternate}>";
|
350 |
$quotes_list .= "<td><input type='checkbox' class='qmn_delete_checkbox' name='delete_results[]' value='".$mlw_quiz_info->result_id. "' /></td>";
|
351 |
+
$quotes_list .= "<td><span style='color:green;font-size:16px;'><a href='admin.php?page=qsm_quiz_result_details&&result_id=".$mlw_quiz_info->result_id."'>View</a>|<a onclick=\"deleteResults('".$mlw_quiz_info->result_id."','".esc_js($mlw_quiz_info->quiz_name)."')\" href='#'>Delete</a></span></td>";
|
352 |
$quotes_list .= "<td><span style='font-size:16px;'>" . $mlw_quiz_info->quiz_name . "</span></td>";
|
353 |
if ($mlw_quiz_info->quiz_system == 0)
|
354 |
{
|
php/admin/options-page-email-tab.php
CHANGED
@@ -44,16 +44,18 @@ function mlw_options_emails_tab_content()
|
|
44 |
array_unshift($mlw_qmn_email_array , $mlw_new_landing_array);
|
45 |
$mlw_qmn_email_array = serialize($mlw_qmn_email_array);
|
46 |
}
|
47 |
-
//Update email template with new array then check to see if worked
|
48 |
$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 ) );
|
49 |
-
if ( false
|
50 |
$mlwQuizMasterNext->alertManager->newAlert(__('The email has been added successfully.', 'quiz-master-next'), 'success');
|
51 |
$mlwQuizMasterNext->audit_manager->new_audit( "New User Email Has Been Created For Quiz Number $mlw_qmn_add_email_id" );
|
52 |
-
}
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
57 |
}
|
58 |
}
|
59 |
|
44 |
array_unshift($mlw_qmn_email_array , $mlw_new_landing_array);
|
45 |
$mlw_qmn_email_array = serialize($mlw_qmn_email_array);
|
46 |
}
|
47 |
+
// Update email template with new array then check to see if worked.
|
48 |
$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 ) );
|
49 |
+
if ( false !== $mlw_new_email_results ) {
|
50 |
$mlwQuizMasterNext->alertManager->newAlert(__('The email has been added successfully.', 'quiz-master-next'), 'success');
|
51 |
$mlwQuizMasterNext->audit_manager->new_audit( "New User Email Has Been Created For Quiz Number $mlw_qmn_add_email_id" );
|
52 |
+
} else {
|
53 |
+
$error = $wpdb->last_error;
|
54 |
+
if ( empty( $error ) ) {
|
55 |
+
$error = __( 'Unknown error', 'quiz-master-next' );
|
56 |
+
}
|
57 |
+
$mlwQuizMasterNext->alertManager->newAlert( sprintf( __( 'There has been an error in this action. Please try again. Error from WordPress: %s', 'quiz-master-next'), $error ), 'error' );
|
58 |
+
$mlwQuizMasterNext->log_manager->add( 'Error creating new user email', "Tried {$wpdb->last_query} but got $error.", 0, 'error');
|
59 |
}
|
60 |
}
|
61 |
|
php/classes/class-qmn-tracking.php
CHANGED
@@ -175,39 +175,46 @@ class QMNTracking {
|
|
175 |
$this->data = $data;
|
176 |
}
|
177 |
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
|
190 |
-
|
191 |
-
|
|
|
|
|
192 |
|
193 |
-
|
194 |
-
|
|
|
|
|
195 |
|
196 |
-
|
|
|
197 |
return;
|
|
|
198 |
|
199 |
-
|
200 |
update_option( 'qmn-tracking-notice', '1' );
|
201 |
} else {
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
|
|
211 |
|
212 |
/**
|
213 |
* Checks If User Has Clicked On Notice
|
175 |
$this->data = $data;
|
176 |
}
|
177 |
|
178 |
+
/**
|
179 |
+
* Adds Admin Notice To Dashboard
|
180 |
+
*
|
181 |
+
* Adds an admin notice asking for authorization to send data home
|
182 |
+
*
|
183 |
+
* @since 4.1.0
|
184 |
+
* @return void
|
185 |
+
*/
|
186 |
+
public function admin_notice() {
|
187 |
+
$show_notice = get_option( 'qmn-tracking-notice' );
|
188 |
+
$settings = (array) get_option( 'qmn-settings' );
|
189 |
|
190 |
+
// If the notice has already been shown, return.
|
191 |
+
if ( $show_notice ) {
|
192 |
+
return;
|
193 |
+
}
|
194 |
|
195 |
+
// If the tracking variable has already been set, return.
|
196 |
+
if ( isset( $settings['tracking_allowed'] ) && $settings['tracking_allowed'] == '1' ) {
|
197 |
+
return;
|
198 |
+
}
|
199 |
|
200 |
+
// If the user does not have the required permissions, return.
|
201 |
+
if( ! current_user_can( 'manage_options' ) ) {
|
202 |
return;
|
203 |
+
}
|
204 |
|
205 |
+
if( stristr( network_site_url( '/' ), 'dev' ) !== false || stristr( network_site_url( '/' ), 'localhost' ) !== false || stristr( network_site_url( '/' ), ':8888' ) !== false ) {
|
206 |
update_option( 'qmn-tracking-notice', '1' );
|
207 |
} else {
|
208 |
+
$optin_url = esc_url( add_query_arg( 'qmn_track_check', 'opt_into_tracking' ) );
|
209 |
+
$optout_url = esc_url( add_query_arg( 'qmn_track_check', 'opt_out_of_tracking' ) );
|
210 |
+
echo '<div class="updated">';
|
211 |
+
echo '<p>' . __( "Allow Quiz And Survey Master to track this plugin's usage and help us make this plugin better? Opt-in to tracking and our newsletter and immediately be emailed a coupon to the QSM store, valid towards the purchase of addons.", 'quiz-master-next' ) . '<p>';
|
212 |
+
echo '<p>' . __( "No sensitive data is tracked. Only feature usage and data about quizzes, surveys, and questions are collected. No user responses or data is ever collected.", 'quiz-master-next' ) . '<p>';
|
213 |
+
echo ' <a href="' . esc_url( $optin_url ) . '" class="button-secondary">' . __( 'Allow', 'quiz-master-next' ) . '</a>';
|
214 |
+
echo ' <a href="' . esc_url( $optout_url ) . '" class="button-secondary">' . __( 'Do not allow', 'quiz-master-next' ) . '</a>';
|
215 |
+
echo '</div>';
|
216 |
+
}
|
217 |
+
}
|
218 |
|
219 |
/**
|
220 |
* Checks If User Has Clicked On Notice
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: quiz, survey, lead, test, score, exam, questionnaire, question
|
|
4 |
Requires at least: 4.8
|
5 |
Tested up to: 4.9
|
6 |
Requires PHP: 5.2
|
7 |
-
Stable tag: 5.2.
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -110,6 +110,11 @@ This is usually a theme conflict. You can [checkout out our common conflict solu
|
|
110 |
|
111 |
== Changelog ==
|
112 |
|
|
|
|
|
|
|
|
|
|
|
113 |
= 5.2.1 (March 5, 2018) =
|
114 |
* Fixes broken "Custom" styles
|
115 |
* Fixes minor bugs in new question editor
|
4 |
Requires at least: 4.8
|
5 |
Tested up to: 4.9
|
6 |
Requires PHP: 5.2
|
7 |
+
Stable tag: 5.2.2
|
8 |
License: GPLv2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
110 |
|
111 |
== Changelog ==
|
112 |
|
113 |
+
= 5.2.2 (April 1, 2018) =
|
114 |
+
* Makes minor style adjustments
|
115 |
+
* Adds additional hook to admin results details page
|
116 |
+
* Modifies a few error messages
|
117 |
+
|
118 |
= 5.2.1 (March 5, 2018) =
|
119 |
* Fixes broken "Custom" styles
|
120 |
* Fixes minor bugs in new question editor
|