Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed issue with contact form location and hide issue #2657

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions php/admin/options-page-contact-tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,19 @@ function qsm_options_contact_tab_content() {
</tr>
<tr valign="top">
<th scope="row" class="qsm-opt-tr">
<label for="loggedin_user_contact"><?php esc_html_e( 'Show contact form to logged in users', 'quiz-master-next' ); ?></label>
<label for="loggedin_user_contact"><?php esc_html_e( 'Hide contact form to logged in users', 'quiz-master-next' ); ?></label>
<span class="dashicons dashicons-editor-help qsm-tooltips-icon">
<span class="qsm-tooltips"><?php esc_html_e( 'The information will still get saved if this option is disabled', 'quiz-master-next' ); ?></span>
</span>
</th>
<td>
<fieldset class="buttonset buttonset-hide" data-hide="1">
<label for="loggedin_user_contact-0">
<input type="radio" id="loggedin_user_contact-0" name="loggedin_user_contact" value="1" <?php checked( $quiz_options['loggedin_user_contact'], '0', true )?>>
<input type="radio" id="loggedin_user_contact-1" name="loggedin_user_contact" value="1" <?php checked( $quiz_options['loggedin_user_contact'], '1', true )?>>
<?php esc_html_e( 'Yes', 'quiz-master-next' ); ?>
</label>
<label for="loggedin_user_contact-1">
<input type="radio" id="loggedin_user_contact-1" name="loggedin_user_contact" value="0" <?php checked( $quiz_options['loggedin_user_contact'], '1', true )?>>
<input type="radio" id="loggedin_user_contact-0" name="loggedin_user_contact" value="0" <?php checked( $quiz_options['loggedin_user_contact'], '0', true )?>>
<?php esc_html_e( 'No', 'quiz-master-next' ); ?>
</label>
</fieldset>
Expand Down Expand Up @@ -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 );
}

Expand Down
6 changes: 3 additions & 3 deletions php/classes/class-qsm-install.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 7 additions & 3 deletions php/classes/class-qsm-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading