From f94d362e3c19920b566a44ac539be478f104711a Mon Sep 17 00:00:00 2001 From: Mohammad Zubair Ali Date: Thu, 26 Oct 2023 13:53:29 +0530 Subject: [PATCH] update draft quiz message --- php/classes/class-qmn-quiz-manager.php | 14 +++++++++++++- php/classes/class-qsm-install.php | 4 +++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/php/classes/class-qmn-quiz-manager.php b/php/classes/class-qmn-quiz-manager.php index eee35a651..a2439fbf0 100644 --- a/php/classes/class-qmn-quiz-manager.php +++ b/php/classes/class-qmn-quiz-manager.php @@ -1562,7 +1562,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' ), @@ -1574,6 +1574,18 @@ public function ajax_submit_results() { ); 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 results.', 'quiz-master-next' ), + 'redirect' => false, + 'result_status' => array( + 'save_response' => false, + ), + ) + ); + 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']; diff --git a/php/classes/class-qsm-install.php b/php/classes/class-qsm-install.php index e0c2259fe..403baf3b7 100644 --- a/php/classes/class-qsm-install.php +++ b/php/classes/class-qsm-install.php @@ -1476,8 +1476,10 @@ public static function install() { time_taken_real DATETIME NOT NULL, quiz_results MEDIUMTEXT NOT NULL, deleted INT NOT NULL, - unique_id varchar(255) NOT NULL, + unique_id varchar(100) NOT NULL, form_type INT NOT NULL, + page_name varchar(255) NOT NULL, + page_url varchar(255) NOT NULL, UNIQUE (unique_id), PRIMARY KEY (result_id) ) $charset_collate;";