From d47a048329613e2f20e8dc8e09dfe6639dc417cd Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Thu, 22 Jun 2023 10:01:15 +0200 Subject: [PATCH] save `meta` to post-meta and persist summary in post-content --- includes/model/class-follower.php | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/includes/model/class-follower.php b/includes/model/class-follower.php index 660bec5..5174f36 100644 --- a/includes/model/class-follower.php +++ b/includes/model/class-follower.php @@ -46,6 +46,13 @@ class Follower { */ private $username; + /** + * The User-Summary + * + * @var string + */ + private $summary; + /** * The Avatar URL * @@ -328,19 +335,6 @@ class Follower { return null; } - /** - * Get the meta data. - * - * @return array $meta The meta data. - */ - public function get_meta() { - if ( $this->meta ) { - return $this->meta; - } - - return null; - } - /** * Update the current Follower-Object. * @@ -363,7 +357,7 @@ class Follower { 'post_title' => $this->get_name(), 'post_author' => 0, 'post_type' => Followers::POST_TYPE, - 'post_content' => wp_json_encode( $this->meta ), + 'post_content' => $this->get_summary(), 'post_status' => 'publish', 'post_modified' => gmdate( 'Y-m-d H:i:s', $this->updated_at ), 'meta_input' => $this->get_post_meta_input(), @@ -400,7 +394,7 @@ class Follower { * @return void */ protected function get_post_meta_input() { - $attributes = array( 'inbox', 'shared_inbox', 'avatar', 'name', 'username' ); + $attributes = array( 'inbox', 'shared_inbox', 'avatar', 'name', 'username', 'meta' ); $meta_input = array();