diff --git a/php/classes/class-qmn-plugin-helper.php b/php/classes/class-qmn-plugin-helper.php index 8e73e67a..41da8402 100644 --- a/php/classes/class-qmn-plugin-helper.php +++ b/php/classes/class-qmn-plugin-helper.php @@ -1123,7 +1123,7 @@ public function convert_contacts_to_preferred_date_format( $qsm_qna_array ) { $qsm_contact_array = $qsm_qna_array['contact']; foreach ( $qsm_contact_array as $qsm_contact_id => $qsm_contact ) { - if ( 'date' === $qsm_contact['type'] && '' !== $qsm_contact['value'] && null !== $GLOBALS['qsm_date_format'] ) { + if ( ( isset($qsm_contact['type']) && 'date' === $qsm_contact['type'] ) && ( isset($qsm_contact['value']) && '' !== $qsm_contact['value'] ) && null !== $GLOBALS['qsm_date_format'] ) { $qsm_qna_array['contact'][ $qsm_contact_id ]['value'] = date_i18n( $GLOBALS['qsm_date_format'], strtotime( ( $qsm_contact['value'] ) ) ); } } diff --git a/php/template-variables.php b/php/template-variables.php index aee4cb81..e03e0d3f 100644 --- a/php/template-variables.php +++ b/php/template-variables.php @@ -525,12 +525,14 @@ function qsm_all_contact_fields_variable( $content, $results ) { $return = ''; if ( isset( $results['contact'] ) && ( is_array( $results['contact'] ) || is_object( $results['contact'] ) ) ) { foreach ( $results['contact'] as $results_contact ) { - $options = qsm_get_options_of_contact_fields($contact_form, $results_contact['label'], $results_contact['type'] ); - $isRadioOrSelect = in_array($results_contact['type'], [ 'radio', 'select' ], true); - $hasOptions = ! empty(trim($options)); + if ( isset( $results_contact['label'] ) && isset( $results_contact['type'] ) && isset( $results_contact['value'] ) ) { + $options = qsm_get_options_of_contact_fields($contact_form, $results_contact['label'], $results_contact['type'] ); + $isRadioOrSelect = in_array($results_contact['type'], [ 'radio', 'select' ], true); + $hasOptions = ! empty(trim($options)); - if ( ($isRadioOrSelect && $hasOptions) || ! $isRadioOrSelect ) { - $return .= $results_contact['label'] . ': ' . $results_contact['value'] . '
'; + if ( ($isRadioOrSelect && $hasOptions) || ! $isRadioOrSelect ) { + $return .= $results_contact['label'] . ': ' . $results_contact['value'] . '
'; + } } } }