Skip to content

Commit a472a99

Browse files
committed
Set default avatar URL when icon is missing
If the actor data does not contain an icon, set and return a default avatar URL, and update the post meta with this value. This ensures that a valid avatar is always available.
1 parent 5ff43e1 commit a472a99

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

includes/collection/class-remote-actors.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,10 @@ public static function get_avatar_url( $id ) {
655655

656656
$actor_data = \json_decode( $post->post_content, true );
657657
if ( empty( $actor_data['icon'] ) ) {
658-
return '';
658+
$default_avatar_url = ACTIVITYPUB_PLUGIN_URL . 'assets/img/mp.jpg';
659+
\update_post_meta( $id, '_activitypub_avatar_url', \esc_url_raw( $default_avatar_url ) );
660+
661+
return $default_avatar_url;
659662
}
660663

661664
$avatar_url = object_to_uri( $actor_data['icon'] );

0 commit comments

Comments
 (0)