Add default blog user icon (#412)
* add a default WP icon for the blog user --------- Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
This commit is contained in:
parent
2705172b77
commit
a91c1c23c8
5 changed files with 18 additions and 6 deletions
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 3.3 KiB |
BIN
assets/img/wp-logo.png
Normal file
BIN
assets/img/wp-logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
|
@ -1 +1 @@
|
||||||
.activitypub-follow-me-block-wrapper .activitypub-profile,.editor-styles-wrapper .activitypub-profile{align-items:self-start;display:flex;padding:1rem}.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__avatar,.editor-styles-wrapper .activitypub-profile .activitypub-profile__avatar{height:75px;margin-right:1rem;width:75px}.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__name,.editor-styles-wrapper .activitypub-profile .activitypub-profile__name{font-size:var(--wp--preset--font-size--large);line-height:1;margin:0}.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__follow,.editor-styles-wrapper .activitypub-profile .activitypub-profile__follow{align-self:center;background-color:var(--wp--preset--color--black);color:var(--wp--preset--color--white);margin-left:auto}.activitypub-follow-me__dialog{max-width:30em}.activitypub-follow-me__dialog h4{line-height:1;margin:0}.activitypub-follow-me__dialog .apmfd__section{margin-bottom:2em}.activitypub-follow-me__dialog .apfmd-description{font-size:var(--wp--preset--font-size--normal,.75rem);margin:.33em 0 1em}.activitypub-follow-me__dialog .apfmd__button-group{display:flex;justify-content:flex-end}.activitypub-follow-me__dialog .apfmd__button-group svg{height:21px;margin-right:.5em;width:21px}.activitypub-follow-me__dialog .apfmd__button-group input{flex:1;padding-left:1em;padding-right:1em}
|
.activitypub-follow-me-block-wrapper .activitypub-profile,.editor-styles-wrapper .activitypub-profile{align-items:self-start;display:flex;padding:1rem}.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__avatar,.editor-styles-wrapper .activitypub-profile .activitypub-profile__avatar{border-radius:50%;height:75px;margin-right:1rem;width:75px}.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__name,.editor-styles-wrapper .activitypub-profile .activitypub-profile__name{font-size:var(--wp--preset--font-size--large);line-height:1;margin:0}.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__follow,.editor-styles-wrapper .activitypub-profile .activitypub-profile__follow{align-self:center;background-color:var(--wp--preset--color--black);color:var(--wp--preset--color--white);margin-left:auto}.activitypub-follow-me__dialog{max-width:30em}.activitypub-follow-me__dialog h4{line-height:1;margin:0}.activitypub-follow-me__dialog .apmfd__section{margin-bottom:2em}.activitypub-follow-me__dialog .apfmd-description{font-size:var(--wp--preset--font-size--normal,.75rem);margin:.33em 0 1em}.activitypub-follow-me__dialog .apfmd__button-group{display:flex;justify-content:flex-end}.activitypub-follow-me__dialog .apfmd__button-group svg{height:21px;margin-right:.5em;width:21px}.activitypub-follow-me__dialog .apfmd__button-group input{flex:1;padding-left:1em;padding-right:1em}
|
||||||
|
|
|
@ -122,23 +122,34 @@ class Blog_User extends User {
|
||||||
/**
|
/**
|
||||||
* Get the User-Icon.
|
* Get the User-Icon.
|
||||||
*
|
*
|
||||||
* @return array|null The User-Icon.
|
* @return array The User-Icon.
|
||||||
*/
|
*/
|
||||||
public function get_icon() {
|
public function get_icon() {
|
||||||
// try site icon first
|
// try site icon first
|
||||||
$icon_id = get_option( 'site_icon' );
|
$icon_id = get_option( 'site_icon' );
|
||||||
|
|
||||||
// try custom logo second
|
// try custom logo second
|
||||||
if ( ! $icon_id ) {
|
if ( ! $icon_id ) {
|
||||||
$icon_id = get_theme_mod( 'custom_logo' );
|
$icon_id = get_theme_mod( 'custom_logo' );
|
||||||
}
|
}
|
||||||
if ( ! $icon_id ) {
|
|
||||||
return null;
|
$icon_url = false;
|
||||||
|
|
||||||
|
if ( $icon_id ) {
|
||||||
|
$icon = wp_get_attachment_image_src( $icon_id, 'full' );
|
||||||
|
if ( $icon ) {
|
||||||
|
$icon_url = $icon[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! $icon_url ) {
|
||||||
|
// fallback to default icon
|
||||||
|
$icon_url = plugins_url( '/assets/img/wp-logo.png', ACTIVITYPUB_PLUGIN_FILE );
|
||||||
}
|
}
|
||||||
|
|
||||||
$image = wp_get_attachment_image_src( $icon_id, 'full' );
|
|
||||||
return array(
|
return array(
|
||||||
'type' => 'Image',
|
'type' => 'Image',
|
||||||
'url' => esc_url( $image[0] ),
|
'url' => esc_url( $icon_url ),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
height: 75px;
|
height: 75px;
|
||||||
width: 75px;
|
width: 75px;
|
||||||
margin-right: 1rem;
|
margin-right: 1rem;
|
||||||
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
.activitypub-profile__name {
|
.activitypub-profile__name {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
Loading…
Reference in a new issue