diff --git a/mlw_quizmaster2.php b/mlw_quizmaster2.php index 7616b755f..f0b958e11 100644 --- a/mlw_quizmaster2.php +++ b/mlw_quizmaster2.php @@ -2,7 +2,7 @@ /** * Plugin Name: Quiz And Survey Master * Description: Easily and quickly add quizzes and surveys to your website. - * Version: 8.1.17 + * Version: 8.1.18 * Author: ExpressTech * Author URI: https://quizandsurveymaster.com/ * Plugin URI: https://expresstech.io/ @@ -43,7 +43,7 @@ class MLWQuizMasterNext { * @var string * @since 4.0.0 */ - public $version = '8.1.17'; + public $version = '8.1.18'; /** * QSM Alert Manager Object diff --git a/php/classes/class-qmn-quiz-manager.php b/php/classes/class-qmn-quiz-manager.php index 7d7ac7658..4e9fd9005 100644 --- a/php/classes/class-qmn-quiz-manager.php +++ b/php/classes/class-qmn-quiz-manager.php @@ -509,13 +509,13 @@ public function display_shortcode( $atts ) { if (encryptedData === undefined) { var encryptedData = {}; } - - - - + + + + encryptionKey['.$quiz_id.'] = "'.hash('sha256',time().$quiz_id).'"; - + data['.$quiz_id.'] = '.wp_json_encode($encryption).'; jsonString['.$quiz_id.'] = JSON.stringify(data['.$quiz_id.']); encryptedData['.$quiz_id.'] = CryptoJS.AES.encrypt(jsonString['.$quiz_id.'], encryptionKey['.$quiz_id.']).toString();'; @@ -1567,7 +1567,7 @@ public function ajax_submit_results() { $post_status = get_post_status( $post_ids[0] ); } - if ( is_null( $options ) || 1 == $options->deleted || 'publish' !== $post_status ) { + if ( is_null( $options ) || 1 == $options->deleted ) { echo wp_json_encode( array( 'display' => __( 'This quiz is no longer available.', 'quiz-master-next' ), @@ -1577,8 +1577,21 @@ public function ajax_submit_results() { ), ) ); - die(); + wp_die(); } + if ( 'publish' !== $post_status ) { + echo wp_json_encode( + array( + 'display' => __( 'This quiz is in draft mode and is not recording your responses. Please publish the quiz to start recording your responses.', 'quiz-master-next' ), + 'redirect' => false, + 'result_status' => array( + 'save_response' => false, + ), + ) + ); + wp_die(); + } + $qsm_option = isset( $options->quiz_settings ) ? maybe_unserialize( $options->quiz_settings ) : array(); $qsm_option = array_map( 'maybe_unserialize', $qsm_option ); $dateStr = $qsm_option['quiz_options']['scheduled_time_end']; @@ -1595,7 +1608,7 @@ public function ajax_submit_results() { ), ) ); - die(); + wp_die(); } if ( 0 != $options->limit_total_entries ) { $mlw_qmn_entries_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(quiz_id) FROM {$wpdb->prefix}mlw_results WHERE deleted=0 AND quiz_id=%d", $options->quiz_id ) ); @@ -1609,7 +1622,7 @@ public function ajax_submit_results() { ), ) ); - die(); + wp_die(); } } if ( 0 != $options->total_user_tries ) { @@ -1636,7 +1649,7 @@ public function ajax_submit_results() { ), ) ); - die(); + wp_die(); } } $data = array( @@ -1646,7 +1659,7 @@ public function ajax_submit_results() { 'quiz_payment_id' => isset( $_POST['main_payment_id'] ) ? sanitize_text_field( wp_unslash( $_POST['main_payment_id'] ) ) : '', ); echo wp_json_encode( $this->submit_results( $options, $data ) ); - die(); + wp_die(); } /** diff --git a/readme.txt b/readme.txt index 94df709ca..b11f48eaa 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: quiz, survey, lead, test, score, exam, questionnaire, question,wordpress q Requires at least: 4.9 Tested up to: 6.3 Requires PHP: 5.4 -Stable tag: 8.1.17 +Stable tag: 8.1.18 License: GPLv2 License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -163,6 +163,9 @@ This is usually a theme conflict. You can [checkout out our common conflict solu 18. Database == Changelog == += 8.1.18 (October 26, 2023) = +* Enhancement: Updated the message when you submit a quiz in draft mode + = 8.1.17 (October 11, 2023) = * Feature: Added option to include custom text when the answer choice limit exceeds in multiple response type questions. * Feature: Added a new feature to accept shortcodes in the text set to display at the end of quizzes.