From f7fec3e71311ff94f5ef397a3a954025076d001c Mon Sep 17 00:00:00 2001 From: Alexander Bigga Date: Mon, 11 Nov 2024 13:39:43 +0100 Subject: [PATCH] Avoid warnings on import old wpcalendar events (#759) --- functions/activation.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/functions/activation.php b/functions/activation.php index 8490e85..40ea028 100644 --- a/functions/activation.php +++ b/functions/activation.php @@ -56,7 +56,7 @@ function sunflower_import_events() { $post->ID = 0; $post->post_type = 'sunflower_event'; - if ( $meta['_secretevent'][0] ) { + if ( isset( $meta['_secretevent'][0] ) && true === $meta['_secretevent'][0] ) { $post->post_status = 'draft'; } @@ -68,18 +68,18 @@ function sunflower_import_events() { update_post_meta( $sunflower_original_post_id, '_sunflower_copied', true ); - update_post_meta( $id, '_sunflower_event_location_city', $meta['_geostadt'][0] ); - update_post_meta( $id, '_sunflower_event_location_name', $meta['_geoshow'][0] ); - update_post_meta( $id, '_sunflower_event_lat', $meta['_lat'][0] ); - update_post_meta( $id, '_sunflower_event_lon', $meta['_lon'][0] ); - update_post_meta( $id, '_sunflower_event_zoom', $meta['_zoom'][0] ); - update_post_meta( $id, '_sunflower_event_organizer', $meta['_veranstalter'][0] ); - update_post_meta( $id, '_sunflower_event_organizer_url', $meta['_veranstalterlnk'][0] ); + update_post_meta( $id, '_sunflower_event_location_city', $meta['_geostadt'][0] ?? '' ); + update_post_meta( $id, '_sunflower_event_location_name', $meta['_geoshow'][0] ?? '' ); + update_post_meta( $id, '_sunflower_event_lat', $meta['_lat'][0] ?? '' ); + update_post_meta( $id, '_sunflower_event_lon', $meta['_lon'][0] ?? '' ); + update_post_meta( $id, '_sunflower_event_zoom', $meta['_zoom'][0] ?? '' ); + update_post_meta( $id, '_sunflower_event_organizer', $meta['_veranstalter'][0] ?? '' ); + update_post_meta( $id, '_sunflower_event_organizer_url', $meta['_veranstalterlnk'][0] ?? '' ); - update_post_meta( $id, '_sunflower_event_from', sunflower_german_date2int_date( $meta['_wpcal_from'][0] ) ); - update_post_meta( $id, '_sunflower_event_until', sunflower_german_date2int_date( $meta['_bis'][0] ) ); + update_post_meta( $id, '_sunflower_event_from', sunflower_german_date2int_date( $meta['_wpcal_from'][0] ?? '' ) ); + update_post_meta( $id, '_sunflower_event_until', sunflower_german_date2int_date( $meta['_bis'][0] ?? '' ) ); - if ( $meta['_thumbnail_id'][0] ) { + if ( isset( $meta['_thumbnail_id'][0] ) ) { update_post_meta( $id, '_thumbnail_id', $meta['_thumbnail_id'][0] ); } }