diff --git a/js/qsm-quiz.js b/js/qsm-quiz.js index 3b9a934e5..7cb166c7b 100644 --- a/js/qsm-quiz.js +++ b/js/qsm-quiz.js @@ -1868,6 +1868,13 @@ function qsm_question_quick_result_js(question_id, answer, answer_type = '', sho got_ans = true; } - return { "correct_index": correct_index, "success": correct_answer ? 'correct' : 'incorrect', "message": show_correct_info && got_ans ? correct_info_text : "" }; + let returnObject = { + "correct_index": correct_index, + "success": correct_answer ? 'correct' : 'incorrect', + "message": show_correct_info && got_ans ? correct_info_text : "" + }; + + jQuery(document).trigger('qsm_question_quick_result_js_after', [returnObject, correct_answer, answer, answer_array, answer_type, settings, decrypt, question_id]); + return returnObject; } } diff --git a/mlw_quizmaster2.php b/mlw_quizmaster2.php index 628392474..3be61e048 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.2.2 + * Version: 8.2.3 * 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.2.2'; + public $version = '8.2.3'; /** * QSM Alert Manager Object diff --git a/php/classes/class-qmn-quiz-creator.php b/php/classes/class-qmn-quiz-creator.php index 91e0498af..048276e73 100644 --- a/php/classes/class-qmn-quiz-creator.php +++ b/php/classes/class-qmn-quiz-creator.php @@ -524,6 +524,7 @@ public function duplicate_quiz( $quiz_id, $quiz_name, $is_duplicating_questions // Update quiz settings $update_quiz_settings = maybe_unserialize( $mlw_qmn_duplicate_data->quiz_settings ); $update_pages = maybe_unserialize( $update_quiz_settings['pages'] ); + $update_q_pages = maybe_unserialize( $update_quiz_settings['qpages'] ); // get logic data from logic table first or else from quiz_settings if ( ! is_null( $logic_table_exists ) ) { $query = $wpdb->prepare( "SELECT * FROM $logic_table WHERE quiz_id = %d", $quiz_id ); @@ -633,6 +634,7 @@ public function duplicate_quiz( $quiz_id, $quiz_name, $is_duplicating_questions foreach ( $pages_value as $pages_k_q => $page_q_id ) { if ( intval($page_q_id) === intval($mlw_question->question_id) ) { $update_pages[ $pages_key ][ $pages_k_q ] = $wpdb->insert_id; + $update_q_pages[ $pages_key ]['questions'][ $pages_k_q ] = $wpdb->insert_id; } } } @@ -681,6 +683,7 @@ public function duplicate_quiz( $quiz_id, $quiz_name, $is_duplicating_questions } } $update_quiz_settings['pages'] = maybe_serialize( $update_pages ); + $update_quiz_settings['qpages'] = maybe_serialize( $update_q_pages ); // saves data in logic table first or else in quiz_settings. $value_array = array(); if ( is_array( $logic_rules ) && ! empty( $logic_rules ) ) { diff --git a/php/classes/class-qmn-quiz-manager.php b/php/classes/class-qmn-quiz-manager.php index 1f2f66acc..4678dfb85 100644 --- a/php/classes/class-qmn-quiz-manager.php +++ b/php/classes/class-qmn-quiz-manager.php @@ -757,7 +757,7 @@ public function load_questions( $quiz_id, $quiz_options, $is_quiz_page, $questio if ( 1 == $quiz_options->randomness_order || 2 == $quiz_options->randomness_order ) { $category_order_sql = 'ORDER BY rand()'; } - $tq_ids[] = $wpdb->get_results( "SELECT DISTINCT `question_id` FROM `{$wpdb->prefix}mlw_question_terms` WHERE `quiz_id` = $quiz_id AND `term_id` = $category AND `taxonomy`='qsm_category' AND question_id NOT IN ($exclude_ids) ".esc_sql( $category_order_sql )." LIMIT $limit", ARRAY_A ); + $tq_ids[] = $wpdb->get_results( "SELECT DISTINCT `question_id` FROM `{$wpdb->prefix}mlw_question_terms` WHERE `quiz_id` = $quiz_id AND `term_id` = $category AND `taxonomy`='qsm_category' AND question_id NOT IN ($exclude_ids) ".esc_sql( $category_order_sql )." LIMIT $limit", ARRAY_A ); } $final_result = array_column(array_merge(...array_map('array_merge', $tq_ids)),'question_id'); if ( 1 == $quiz_options->randomness_order || 2 == $quiz_options->randomness_order ) { @@ -903,6 +903,7 @@ public function display_quiz( $options, $quiz_data, $question_amount, $shortcode wp_enqueue_script( 'jquery-ui-core' ); wp_enqueue_script( 'jquery-ui-tooltip' ); wp_enqueue_style( 'jquery-redmond-theme', QSM_PLUGIN_CSS_URL . '/jquery-ui.css', array(), $mlwQuizMasterNext->version ); + wp_enqueue_style( 'qsm_quiz_common_style', $this->common_css, array(), $mlwQuizMasterNext->version ); global $qmn_json_data; $qmn_json_data['error_messages'] = array( @@ -1549,7 +1550,7 @@ public function display_results( $options, $data ) { if ( ! isset( $_REQUEST['qsm_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['qsm_nonce'] ) ), 'qsm_submit_quiz_' . intval( $quiz_id ) ) ) { echo wp_json_encode( array( - 'display' => htmlspecialchars_decode( 'Nonce Validation failed!' ), + 'display' => __( 'Nonce Validation failed!', 'quiz-master-next' ), 'redirect' => false, 'result_status' => array( 'save_response' => false, @@ -1636,7 +1637,7 @@ public function ajax_submit_results() { 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' => htmlspecialchars_decode( 'Quiz Expired!' ), + 'display' => __( 'Quiz Expired!', 'quiz-master-next' ), 'redirect' => false, 'result_status' => array( 'save_response' => false, @@ -1910,7 +1911,7 @@ public function submit_results( $qmn_quiz_options, $qmn_array_for_variables ) { if ( 1 === intval( $qmn_quiz_options->store_responses ) && ! $qmn_array_for_variables['response_saved'] ) { $result_display .= '