diff --git a/mlw_quizmaster2.php b/mlw_quizmaster2.php index 4ec867dc3..f0b958e11 100644 --- a/mlw_quizmaster2.php +++ b/mlw_quizmaster2.php @@ -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 @@ -361,7 +361,6 @@ public function qsm_admin_scripts_style( $hook ) { wp_enqueue_script( 'jquery-ui-tabs' ); wp_enqueue_script( 'jquery-effects-blind' ); wp_enqueue_script( 'jquery-effects-explode' ); - wp_enqueue_media(); break; default: wp_enqueue_editor(); diff --git a/php/classes/class-qmn-quiz-manager.php b/php/classes/class-qmn-quiz-manager.php index 0d10c9d0e..f5d170221 100644 --- a/php/classes/class-qmn-quiz-manager.php +++ b/php/classes/class-qmn-quiz-manager.php @@ -1567,7 +1567,7 @@ public function ajax_submit_results() { $post_status = get_post_status( $post_ids[0] ); } - if ( is_null( $options ) || 1 == $options->deleted ) { + if ( is_null( $options ) || 1 == $options->deleted || 'publish' !== $post_status ) { echo wp_json_encode( array( 'display' => __( 'This quiz is no longer available.', 'quiz-master-next' ), @@ -1579,10 +1579,16 @@ public function ajax_submit_results() { ); die(); } - if ( 'publish' !== $post_status ) { + $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']; + $timezone = isset( $_POST['currentuserTimeZone'] ) ? sanitize_text_field( wp_unslash( $_POST['currentuserTimeZone'] ) ) : ''; + $dtUtcDate = strtotime( $dateStr . ' ' . $timezone ); + + if ( isset($qsm_option['quiz_options']['not_allow_after_expired_time']) && '1' === $qsm_option['quiz_options']['not_allow_after_expired_time'] && isset( $_POST['currentuserTime'] ) && sanitize_text_field( wp_unslash( $_POST['currentuserTime'] ) ) > $dtUtcDate && ! empty($dateStr) ) { 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' ), + 'display' => htmlspecialchars_decode( 'Quiz Expired!' ), 'redirect' => false, 'result_status' => array( 'save_response' => false, @@ -1591,16 +1597,10 @@ public function ajax_submit_results() { ); 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']; - $timezone = isset( $_POST['currentuserTimeZone'] ) ? sanitize_text_field( wp_unslash( $_POST['currentuserTimeZone'] ) ) : ''; - $dtUtcDate = strtotime( $dateStr . ' ' . $timezone ); - - if ( isset($qsm_option['quiz_options']['not_allow_after_expired_time']) && '1' === $qsm_option['quiz_options']['not_allow_after_expired_time'] && isset( $_POST['currentuserTime'] ) && sanitize_text_field( wp_unslash( $_POST['currentuserTime'] ) ) > $dtUtcDate && ! empty($dateStr) ) { + if ( 'publish' !== $post_status ) { echo wp_json_encode( array( - 'display' => htmlspecialchars_decode( 'Quiz Expired!' ), + '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, @@ -1871,9 +1871,6 @@ public function submit_results( $qmn_quiz_options, $qmn_array_for_variables ) { // Determines redirect/results page. $results_pages = $this->display_results_text( $qmn_quiz_options, $qmn_array_for_variables ); - if ( 1 === intval( $qmn_quiz_options->store_responses ) && ! $qmn_array_for_variables['response_saved'] ) { - $result_display .= '