From 7ab51b104eb4a956a9eade9fd69897855c6b0108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Fri, 27 Sep 2024 18:04:29 +0200 Subject: [PATCH] Fix location for tribe (#36) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updates did not work. Always use the tribe_event instead of the wp_object where ever possible! Reviewed-on: https://code.event-federation.eu/Event-Federation/wordpress-activitypub-event-extensions/pulls/36 Co-authored-by: André Menrath Co-committed-by: André Menrath --- .../activitypub/transformer/class-the-events-calendar.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/activitypub/transformer/class-the-events-calendar.php b/includes/activitypub/transformer/class-the-events-calendar.php index 7707ca8..0c1e617 100644 --- a/includes/activitypub/transformer/class-the-events-calendar.php +++ b/includes/activitypub/transformer/class-the-events-calendar.php @@ -136,7 +136,7 @@ final class The_Events_Calendar extends Event { */ public function get_location(): Place|null { // Get short handle for the venues. - $venues = $this->wp_object->venues; + $venues = $this->tribe_event->venues; // Get first venue. We currently only support a single venue. if ( $venues instanceof \Tribe\Events\Collections\Lazy_Post_Collection ) { @@ -181,6 +181,8 @@ final class The_Events_Calendar extends Event { $location = new Place(); if ( count( $address ) > 1 ) { $location->set_address( $address ); + } else { + $location->set_address( $venue->post_title ); } $location->set_id( $venue->permalink ); $location->set_name( $venue->post_title );