diff --git a/includes/model/class-post.php b/includes/model/class-post.php index 8e58a07..5ebeb34 100644 --- a/includes/model/class-post.php +++ b/includes/model/class-post.php @@ -1,6 +1,7 @@ post_author, $this->post ); + } + /** * Converts this Object into an Array. * - * @return array + * @return array the array representation of a Post. */ public function to_array() { $post = $this->post; @@ -203,7 +213,7 @@ class Post { 'url' => $this->get_url(), 'type' => $this->get_object_type(), 'published' => \gmdate( 'Y-m-d\TH:i:s\Z', \strtotime( $post->post_date_gmt ) ), - 'attributedTo' => \get_author_posts_url( $post->post_author ), + 'attributedTo' => $this->get_actor(), 'summary' => $this->get_summary(), 'inReplyTo' => null, 'content' => $this->get_content(), @@ -219,6 +229,17 @@ class Post { return \apply_filters( 'activitypub_post', $array, $this->post ); } + /** + * Returns the Actor of this Object. + * + * @return string The URL of the Actor. + */ + public function get_actor() { + $user = User_Factory::get_by_id( $this->get_user_id() ); + + return $user->get_url(); + } + /** * Converts this Object into a JSON String *