From 960d28363bab7fe516bfbdb71a5dfda59e43b66d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Thu, 18 Jan 2024 17:22:17 +0100 Subject: [PATCH] fix vs_event transformer --- activitypub-event-extensions.php | 2 +- includes/activitypub/transformer/class-vs-event.php | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/activitypub-event-extensions.php b/activitypub-event-extensions.php index f676c3d..679f387 100644 --- a/activitypub-event-extensions.php +++ b/activitypub-event-extensions.php @@ -35,7 +35,7 @@ add_filter( */ if ( class_exists( 'vsel_widget' ) && $wp_object->post_type === 'event' ) { require_once __DIR__ . '/includes/activitypub/transformer/class-vs-event.php'; - return new \VS_Event( $object ); + return new \VS_Event( $wp_object ); } /** diff --git a/includes/activitypub/transformer/class-vs-event.php b/includes/activitypub/transformer/class-vs-event.php index 1b8b7e9..bdd1502 100644 --- a/includes/activitypub/transformer/class-vs-event.php +++ b/includes/activitypub/transformer/class-vs-event.php @@ -241,10 +241,10 @@ class VS_Event extends Post { } $setter_function = 'set_' . $key; + $getter_function = 'get_' . $key; - if ( in_array($key, get_class_methods( $this ) )) { - $getter_function = 'get_' . $key; - $this->ap_object->$setter_function( $this->$getter_function ); + if ( in_array( $getter_function, get_class_methods( $this ) ) ) { + $this->ap_object->$setter_function( $this->$getter_function() ); } else { $this->ap_object->$setter_function( $value ); } @@ -290,14 +290,16 @@ class VS_Event extends Post { ->set_type() ->set_category() ->set_attachments() - ->set_location() + ->set_location() ->set_comments_enabled( true ) ->set_external_participation_url( $this->get_url() ) - ->set_status( 'CONFIRMED' ) + ->set_status( 'CONFIRMED' ) ->set_name( get_the_title( $this->wp_object->ID ) ) ->set_is_online( false ) ->set_in_language( $this->get_locale() ) ->set_actor( get_rest_url_by_path( 'application' ) ) ->set_to( array( 'https://www.w3.org/ns/activitystreams#Public' ) ); + + return $this->ap_object; } }