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 php warning if quiz_settings are blank #2588

Merged
merged 1 commit into from
Jun 19, 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
4 changes: 2 additions & 2 deletions php/classes/class-qsm-contact-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ public static function generate_contact_field( $field, $index, $quiz_options, $d
/**
* Add options validation
*/
if ( isset( $field['options'] ) && !empty( trim( $field['options'] ) ) ) {
if ( isset( $field['options'] ) && ! empty( trim( $field['options'] ) ) ) {
?>
<span class='mlw_qmn_question qsm_question'><?php echo esc_attr( $field_label ); ?></span>
<div class='qmn_radio_answers <?php echo esc_attr( $class ); ?>'>
Expand Down Expand Up @@ -603,7 +603,7 @@ class="qmn_quiz_radio"
$fieldAttr .= " autocomplete='off' ";
}
// If REQUIRED is set then assigning the required class
if ( isset( $field['options'] ) && !empty( trim( $field['options'] ) ) ) {
if ( isset( $field['options'] ) && ! empty( trim( $field['options'] ) ) ) {
?>
<span class='mlw_qmn_question qsm_question'><label for="contact_field_<?php echo esc_attr( $index ) ?>"><?php echo esc_attr( $field_label ); ?></label></span>
<select class='<?php echo esc_attr( $class ); ?>' name='contact_field_<?php echo esc_attr( $index ); ?>' id='contact_field_<?php echo esc_attr( $index ); ?>'>
Expand Down
4 changes: 3 additions & 1 deletion php/classes/class-qsm-install.php
Original file line number Diff line number Diff line change
Expand Up @@ -2029,7 +2029,9 @@ public function update() {
if ( ! get_option( 'fixed_duplicate_questions' ) ) {
QSM_Migrate::fix_duplicate_questions();
}
QSM_Migrate::fix_deleted_quiz_posts();
if ( ! get_option( 'fix_deleted_quiz_posts' ) ) {
QSM_Migrate::fix_deleted_quiz_posts();
}

update_option( 'mlw_quiz_master_version', $data );
}
Expand Down
3 changes: 2 additions & 1 deletion php/classes/class-qsm-migrate.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public static function fix_duplicate_questions() {
if ( ! empty( $all_quizzes ) ) {
foreach ( $all_quizzes as $quiz ) {
$quiz_id = $quiz->quiz_id;
$settings = maybe_unserialize( $quiz->quiz_settings );
$settings = ! empty( $quiz->quiz_settings ) ? maybe_unserialize( $quiz->quiz_settings ) : array();
$pages = isset( $settings['pages'] ) ? maybe_unserialize( $settings['pages'] ) : array();
$qpages = isset( $settings['qpages'] ) ? maybe_unserialize( $settings['qpages'] ) : array();
if ( ! empty( $pages ) ) {
Expand Down Expand Up @@ -179,6 +179,7 @@ public static function fix_deleted_quiz_posts() {
}
}
}
update_option( 'fix_deleted_quiz_posts', 1 );
}

}
Loading