From 58b0cc44a3424c666d27aba4563fff869b9b3486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Wed, 9 Oct 2024 18:03:02 +0200 Subject: [PATCH] wp event manager: small improvements --- .../transformer/class-wp-event-manager.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/includes/activitypub/transformer/class-wp-event-manager.php b/includes/activitypub/transformer/class-wp-event-manager.php index 4f560b5..8b7236a 100644 --- a/includes/activitypub/transformer/class-wp-event-manager.php +++ b/includes/activitypub/transformer/class-wp-event-manager.php @@ -48,12 +48,17 @@ final class WP_Event_Manager extends Event_Transformer { * @return array The Place. */ public function get_location(): ?Place { - $location = new Place(); $location_name = get_post_meta( $this->wp_object->ID, '_event_online', true ); - $location->set_name( $location_name ); - $location->set_sensitive( null ); - $location->set_address( $location_name ); - return $location; + + if ( $location_name ) { + $location = new Place(); + $location->set_name( $location_name ); + $location->set_sensitive( null ); + $location->set_address( $location_name ); + + return $location; + } + return null; } /**