fix vs_event transformer

This commit is contained in:
André Menrath 2024-01-18 17:22:17 +01:00
parent 6ae202be9a
commit 960d28363b
2 changed files with 8 additions and 6 deletions

View file

@ -35,7 +35,7 @@ add_filter(
*/ */
if ( class_exists( 'vsel_widget' ) && $wp_object->post_type === 'event' ) { if ( class_exists( 'vsel_widget' ) && $wp_object->post_type === 'event' ) {
require_once __DIR__ . '/includes/activitypub/transformer/class-vs-event.php'; require_once __DIR__ . '/includes/activitypub/transformer/class-vs-event.php';
return new \VS_Event( $object ); return new \VS_Event( $wp_object );
} }
/** /**

View file

@ -241,10 +241,10 @@ class VS_Event extends Post {
} }
$setter_function = 'set_' . $key; $setter_function = 'set_' . $key;
$getter_function = 'get_' . $key;
if ( in_array($key, get_class_methods( $this ) )) { if ( in_array( $getter_function, get_class_methods( $this ) ) ) {
$getter_function = 'get_' . $key; $this->ap_object->$setter_function( $this->$getter_function() );
$this->ap_object->$setter_function( $this->$getter_function );
} else { } else {
$this->ap_object->$setter_function( $value ); $this->ap_object->$setter_function( $value );
} }
@ -290,14 +290,16 @@ class VS_Event extends Post {
->set_type() ->set_type()
->set_category() ->set_category()
->set_attachments() ->set_attachments()
->set_location() ->set_location()
->set_comments_enabled( true ) ->set_comments_enabled( true )
->set_external_participation_url( $this->get_url() ) ->set_external_participation_url( $this->get_url() )
->set_status( 'CONFIRMED' ) ->set_status( 'CONFIRMED' )
->set_name( get_the_title( $this->wp_object->ID ) ) ->set_name( get_the_title( $this->wp_object->ID ) )
->set_is_online( false ) ->set_is_online( false )
->set_in_language( $this->get_locale() ) ->set_in_language( $this->get_locale() )
->set_actor( get_rest_url_by_path( 'application' ) ) ->set_actor( get_rest_url_by_path( 'application' ) )
->set_to( array( 'https://www.w3.org/ns/activitystreams#Public' ) ); ->set_to( array( 'https://www.w3.org/ns/activitystreams#Public' ) );
return $this->ap_object;
} }
} }