From c9fdafdacb330bf4aef355fc80dfa8c84c1122f6 Mon Sep 17 00:00:00 2001 From: Mohammad Zubair Ali Date: Tue, 1 Oct 2024 13:48:09 +0530 Subject: [PATCH] fixed issue with contact form location and hide issue --- php/admin/options-page-contact-tab.php | 9 +++------ php/classes/class-qsm-install.php | 6 +++--- php/classes/class-qsm-settings.php | 10 +++++++--- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/php/admin/options-page-contact-tab.php b/php/admin/options-page-contact-tab.php index d111a98f1..e5138fa8d 100644 --- a/php/admin/options-page-contact-tab.php +++ b/php/admin/options-page-contact-tab.php @@ -88,7 +88,7 @@ function qsm_options_contact_tab_content() { - + @@ -96,11 +96,11 @@ function qsm_options_contact_tab_content() {
@@ -182,9 +182,6 @@ function qsm_contact_form_admin_ajax() { foreach ( $settings as $key => $val ) { $quiz_options[ $key ] = $val; } - if ( isset($settings['loggedin_user_contact']) ) { - $quiz_options['loggedin_user_contact'] = (1 == $settings['loggedin_user_contact']) ? 0 : 1; - } $mlwQuizMasterNext->pluginHelper->update_quiz_setting( 'quiz_options', $quiz_options ); } diff --git a/php/classes/class-qsm-install.php b/php/classes/class-qsm-install.php index 2e9918b53..134d91bc3 100644 --- a/php/classes/class-qsm-install.php +++ b/php/classes/class-qsm-install.php @@ -729,16 +729,16 @@ public function register_default_settings() { // Registers loggedin_user_contact setting $field_array = array( 'id' => 'loggedin_user_contact', - 'label' => __( 'Show contact form to logged in users', 'quiz-master-next' ), + 'label' => __( 'Hide contact form to logged in users', 'quiz-master-next' ), 'type' => 'radio', 'options' => array( array( 'label' => __( 'Yes', 'quiz-master-next' ), - 'value' => 0, + 'value' => 1, ), array( 'label' => __( 'No', 'quiz-master-next' ), - 'value' => 1, + 'value' => 0, ), ), 'default' => 0, diff --git a/php/classes/class-qsm-settings.php b/php/classes/class-qsm-settings.php index 863894099..6c0a79ea3 100644 --- a/php/classes/class-qsm-settings.php +++ b/php/classes/class-qsm-settings.php @@ -470,9 +470,13 @@ public function get_quiz_options() { $quiz_options = array_merge( $quiz_options, $options ); } - $text = $this->get_setting( 'quiz_text' ); - if ( is_array( $text ) ) { - $quiz_options = array_merge( $quiz_options, $text ); + $text = $this->get_setting('quiz_text'); + if (is_array($text)) { + foreach ($text as $key => $value) { + if (!empty($value)) { + $quiz_options[$key] = $value; + } + } } // Return as old object model