Skip to content

Commit 4da3939

Browse files
committed
Respect show_avatars setting in Avatars class fallback
Also apply the show_avatars check to the backward compatibility fallback that uses avatar_url comment meta directly.
1 parent 7f4d0a7 commit 4da3939

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

includes/class-avatars.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,22 @@ public static function pre_get_avatar_data( $args, $id_or_email ) {
4747
return $args;
4848
}
4949

50-
$avatar = null;
50+
// Respect WordPress "show avatars" setting.
51+
if ( ! \get_option( 'show_avatars' ) ) {
52+
$avatar = ACTIVITYPUB_PLUGIN_URL . 'assets/img/mp.jpg';
53+
} else {
54+
$avatar = null;
5155

52-
// First, try to get avatar from remote actor.
53-
$remote_actor_id = \get_comment_meta( $id_or_email->comment_ID, '_activitypub_remote_actor_id', true );
54-
if ( $remote_actor_id ) {
55-
$avatar = Remote_Actors::get_avatar_url( $remote_actor_id );
56-
}
56+
// First, try to get avatar from remote actor.
57+
$remote_actor_id = \get_comment_meta( $id_or_email->comment_ID, '_activitypub_remote_actor_id', true );
58+
if ( $remote_actor_id ) {
59+
$avatar = Remote_Actors::get_avatar_url( $remote_actor_id );
60+
}
5761

58-
// Fall back to avatar_url comment meta for backward compatibility.
59-
if ( ! $avatar ) {
60-
$avatar = \get_comment_meta( $id_or_email->comment_ID, 'avatar_url', true );
62+
// Fall back to avatar_url comment meta for backward compatibility.
63+
if ( ! $avatar ) {
64+
$avatar = \get_comment_meta( $id_or_email->comment_ID, 'avatar_url', true );
65+
}
6166
}
6267

6368
if ( $avatar ) {

0 commit comments

Comments
 (0)