Skip to content

Commit

Permalink
merged with dev
Browse files Browse the repository at this point in the history
  • Loading branch information
iam-pranav committed Oct 3, 2024
2 parents 24f632a + a07bfe9 commit 8d1bd0e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
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

0 comments on commit 8d1bd0e

Please sign in to comment.