From 52038c9f43f1ea3356b937869e492317888fb4db Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Wed, 5 Jul 2023 15:32:26 +0200 Subject: [PATCH] fix image and username handling --- includes/model/class-blog-user.php | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/includes/model/class-blog-user.php b/includes/model/class-blog-user.php index c3b6cb1..2549fc4 100644 --- a/includes/model/class-blog-user.php +++ b/includes/model/class-blog-user.php @@ -66,7 +66,7 @@ class Blog_User extends User { * @return string The User-Url. */ public function get_url() { - return \esc_url( \trailingslashit( get_home_url() ) . '@' . $this->get_username() ); + return \esc_url( \trailingslashit( get_home_url() ) . '@' . $this->get_preferred_username() ); } /** @@ -116,17 +116,29 @@ class Blog_User extends User { return $default; } - public function get_username() { + public function get_preferred_username() { return self::get_default_username(); } - public function get_avatar() { - return \esc_url( \get_site_icon_url( 120 ) ); + public function get_icon() { + $image = wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ) ); + + if ( $image ) { + return array( + 'type' => 'Image', + 'url' => esc_url( $image[0] ), + ); + } + + return null; } public function get_header_image() { if ( \has_header_image() ) { - return esc_url( \get_header_image() ); + return array( + 'type' => 'Image', + 'url' => esc_url( \get_header_image() ), + ); } return null;