save meta to post-meta and persist summary in post-content

This commit is contained in:
Matthias Pfefferle 2023-06-22 10:01:15 +02:00
parent a69afb5f89
commit d47a048329

View file

@ -46,6 +46,13 @@ class Follower {
*/ */
private $username; private $username;
/**
* The User-Summary
*
* @var string
*/
private $summary;
/** /**
* The Avatar URL * The Avatar URL
* *
@ -328,19 +335,6 @@ class Follower {
return null; 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. * Update the current Follower-Object.
* *
@ -363,7 +357,7 @@ class Follower {
'post_title' => $this->get_name(), 'post_title' => $this->get_name(),
'post_author' => 0, 'post_author' => 0,
'post_type' => Followers::POST_TYPE, 'post_type' => Followers::POST_TYPE,
'post_content' => wp_json_encode( $this->meta ), 'post_content' => $this->get_summary(),
'post_status' => 'publish', 'post_status' => 'publish',
'post_modified' => gmdate( 'Y-m-d H:i:s', $this->updated_at ), 'post_modified' => gmdate( 'Y-m-d H:i:s', $this->updated_at ),
'meta_input' => $this->get_post_meta_input(), 'meta_input' => $this->get_post_meta_input(),
@ -400,7 +394,7 @@ class Follower {
* @return void * @return void
*/ */
protected function get_post_meta_input() { 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(); $meta_input = array();