diff --git a/blocks/block.php b/blocks/block.php index 6c6fc3e94..d16042ebf 100644 --- a/blocks/block.php +++ b/blocks/block.php @@ -306,7 +306,7 @@ public function register_editor_rest_routes() { 'methods' => WP_REST_Server::CREATABLE, 'callback' => array( $this, 'hierarchical_category_list' ), 'permission_callback' => function () { - return current_user_can( 'edit_posts' ); + return current_user_can( 'edit_qsm_quizzes' ); }, ) ); @@ -319,7 +319,7 @@ public function register_editor_rest_routes() { 'methods' => WP_REST_Server::CREATABLE, 'callback' => array( $this, 'advance_question_type_upgrade_popup' ), 'permission_callback' => function () { - return current_user_can( 'edit_posts' ); + return current_user_can( 'edit_qsm_quizzes' ); }, ) ); @@ -332,7 +332,7 @@ public function register_editor_rest_routes() { 'methods' => WP_REST_Server::CREATABLE, 'callback' => array( $this, 'qsm_quiz_structure_data' ), 'permission_callback' => function () { - return current_user_can( 'edit_posts' ); + return current_user_can( 'edit_qsm_quizzes' ); }, ) ); @@ -345,7 +345,7 @@ public function register_editor_rest_routes() { 'methods' => WP_REST_Server::CREATABLE, 'callback' => array( $this, 'create_new_quiz_from_editor' ), 'permission_callback' => function () { - return current_user_can( 'edit_posts' ); + return current_user_can( 'edit_qsm_quizzes' ); }, ) ); @@ -358,7 +358,7 @@ public function register_editor_rest_routes() { 'methods' => WP_REST_Server::CREATABLE, 'callback' => array( $this, 'save_quiz' ), 'permission_callback' => function () { - return current_user_can( 'edit_posts' ); + return current_user_can( 'edit_qsm_quizzes' ); }, ) ); diff --git a/js/qsm-quiz.js b/js/qsm-quiz.js index bbd87c641..735aa5090 100644 --- a/js/qsm-quiz.js +++ b/js/qsm-quiz.js @@ -52,8 +52,6 @@ var qsmTimerInterval = []; if (quiz.hasOwnProperty('timer_limit') && 0 != quiz.timer_limit) { QSM.initTimer(quizID); quizType = 'timer'; - } else { - qsmTimerInterval[quizID] = setInterval(function () { qmnTimeTakenTimer(quizID) }, 1000); } if (jQuery('.qsm-quiz-container-' + quizID + ' .qsm-submit-btn').is(':visible') && !jQuery('.qsm-quiz-container-' + quizID).hasClass('qsm_auto_pagination_enabled') ) { jQuery('.qsm-quiz-container-' + quizID + ' .qsm-quiz-comment-section').fadeIn(); @@ -173,6 +171,10 @@ var qsmTimerInterval = []; jQuery(document).trigger('qmn_timer_consumed_seconds', [quizID, qmn_quiz_data, qsm_timer_consumed_obj]); if (localStorage.getItem('mlw_time_quiz' + quizID) != null ) { secondsRemaining = (parseFloat(qmn_quiz_data[quizID].timer_limit) * 60) - secondsConsumed + 1; + if(qsm_timer_consumed_obj.qmn_count_upward_status){ + secondsConsumed = qmn_quiz_data[quizID].timerConsumed - 1; + secondsRemaining = (parseFloat(qmn_quiz_data[quizID].timer_limit) * 60) - secondsConsumed; + } if(secondsRemaining < 0) { secondsRemaining = 0; } @@ -2018,13 +2020,13 @@ jQuery(document).keydown(function(event) { return; } } - if ([39, 37, 13, 9].includes(event.keyCode) && jQuery('textarea:focus').length === 0) { + if ([39, 37, 13, 9].includes(event.keyCode) && jQuery('textarea:focus, input[type="text"]:focus, input[type="email"]:focus, input[type="number"]:focus').length === 0) { event.preventDefault(); } - if (event.keyCode === 39) { + if (event.keyCode === 39 && jQuery('textarea:focus, input[type="text"]:focus, input[type="email"]:focus, input[type="number"]:focus').length === 0 ) { jQuery('.qsm-quiz-container.qsm-recently-active').find('.mlw_next:visible').click(); } - if (event.keyCode === 37) { + if (event.keyCode === 37 && jQuery('textarea:focus, input[type="text"]:focus, input[type="email"]:focus, input[type="number"]:focus').length === 0 ) { jQuery('.qsm-quiz-container.qsm-recently-active').find('.mlw_previous:visible').click(); } if (event.keyCode === 13 && jQuery('textarea:focus').length === 0) { diff --git a/mlw_quizmaster2.php b/mlw_quizmaster2.php index 2a6e8e6bc..57364677d 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: 9.2.1 + * Version: 9.2.2 * 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 = '9.2.1'; + public $version = '9.2.2'; /** * QSM Alert Manager Object @@ -840,6 +840,7 @@ public function setup_admin_menu() { 'manage_qsm_quiz_categories', 'manage_qsm_quiz_answer_label', 'view_qsm_quiz_result', + 'manage_options', ); add_menu_page( 'Quiz And Survey Master', __( 'QSM', 'quiz-master-next' ), $capabilities[1], 'qsm_dashboard', 'qsm_generate_dashboard_page', 'dashicons-feedback', $menu_position ); @@ -862,7 +863,7 @@ public function setup_admin_menu() { add_submenu_page( 'qsm_dashboard', __( 'Failed DB Queries', 'quiz-master-next' ), __( 'Failed Database Queries', 'quiz-master-next' ), $capabilities[2], 'qsm-database-failed-queries', array( $this, 'qsm_database_failed_queries' ) ); } add_submenu_page( 'options.php', __( 'Result Details', 'quiz-master-next' ), __( 'Result Details', 'quiz-master-next' ), $capabilities[5], 'qsm_quiz_result_details', 'qsm_generate_result_details' ); - add_submenu_page( 'qsm_dashboard', __( 'Settings', 'quiz-master-next' ), __( 'Settings', 'quiz-master-next' ), $capabilities[2], 'qmn_global_settings', array( 'QMNGlobalSettingsPage', 'display_page' ) ); + add_submenu_page( 'qsm_dashboard', __( 'Settings', 'quiz-master-next' ), __( 'Settings', 'quiz-master-next' ), $capabilities[6], 'qmn_global_settings', array( 'QMNGlobalSettingsPage', 'display_page' ) ); add_submenu_page( 'qsm_dashboard', __( 'Tools', 'quiz-master-next' ), __( 'Tools', 'quiz-master-next' ), $capabilities[2], 'qsm_quiz_tools', 'qsm_generate_quiz_tools' ); add_submenu_page( 'qsm_dashboard', __( 'Stats', 'quiz-master-next' ), __( 'Stats', 'quiz-master-next' ), $capabilities[2], 'qmn_stats', 'qmn_generate_stats_page' ); add_submenu_page( 'qsm_dashboard', __( 'About', 'quiz-master-next' ), __( 'About', 'quiz-master-next' ), $capabilities[2], 'qsm_quiz_about', 'qsm_generate_about_page' ); diff --git a/php/admin/about-page.php b/php/admin/about-page.php index b54d9cc21..60fd79854 100644 --- a/php/admin/about-page.php +++ b/php/admin/about-page.php @@ -18,7 +18,7 @@ function qsm_generate_about_page() { global $mlwQuizMasterNext; $version = $mlwQuizMasterNext->version; - if ( ! current_user_can( 'moderate_comments' ) ) { + if ( ! current_user_can( 'delete_others_qsm_quizzes' ) ) { return; } $tab_array = [ diff --git a/php/admin/addons-page.php b/php/admin/addons-page.php index 6c055261d..00c81c5b5 100644 --- a/php/admin/addons-page.php +++ b/php/admin/addons-page.php @@ -10,7 +10,7 @@ * @since 4.4.0 */ function qmn_addons_page() { - if ( ! current_user_can( 'moderate_comments' ) ) { + if ( ! current_user_can( 'delete_others_qsm_quizzes' ) ) { return; } diff --git a/php/admin/admin-dashboard.php b/php/admin/admin-dashboard.php index b4f2eb7c8..21895a48b 100644 --- a/php/admin/admin-dashboard.php +++ b/php/admin/admin-dashboard.php @@ -102,7 +102,7 @@ function qsm_dashboard_screen_options( $status, $args ) { */ function qsm_generate_dashboard_page() { // Only let admins and editors see this page. - if ( ! current_user_can( 'edit_posts' ) ) { + if ( ! current_user_can( 'edit_qsm_quizzes' ) ) { return; } global $mlwQuizMasterNext; diff --git a/php/admin/options-page-text-tab.php b/php/admin/options-page-text-tab.php index ad85cf3ce..0404ce1cb 100644 --- a/php/admin/options-page-text-tab.php +++ b/php/admin/options-page-text-tab.php @@ -116,7 +116,7 @@ function mlw_options_text_tab_content() { ?> - +