From f0fc2b8d89e5e5493946855d4e9e13ecf22cb10f Mon Sep 17 00:00:00 2001 From: faisal-alvi Date: Wed, 15 May 2024 15:36:55 +0530 Subject: [PATCH 1/3] Fix Default Avatar Fallback (Param: `default` vs `url`) --- includes/class-simple-local-avatars.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/includes/class-simple-local-avatars.php b/includes/class-simple-local-avatars.php index 3a52bae..bc2ce6b 100644 --- a/includes/class-simple-local-avatars.php +++ b/includes/class-simple-local-avatars.php @@ -276,11 +276,15 @@ public function get_avatar_data( $args, $id_or_email ) { // Local only mode if ( ! $simple_local_avatar_url ) { - $default_url = $this->get_default_avatar_url( $args['size'] ); + $default_url = $this->get_default_avatar_url( $args['size'] ); + $avatar_default = get_option( 'avatar_default' ); + if ( ! empty( $this->options['only'] ) ) { $args['url'] = $default_url; - } else { + } elseif ( 'simple_local_avatar' === $avatar_default ) { $args['default'] = $default_url; + } else { + $args['url'] = $default_url; } } From 7075d7c639c37cecdbd29685a44f1ab7a2dac6da Mon Sep 17 00:00:00 2001 From: faisal-alvi Date: Wed, 15 May 2024 16:47:27 +0530 Subject: [PATCH 2/3] remove setting full URL for other (non-media) default avatars --- includes/class-simple-local-avatars.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/includes/class-simple-local-avatars.php b/includes/class-simple-local-avatars.php index bc2ce6b..829e382 100644 --- a/includes/class-simple-local-avatars.php +++ b/includes/class-simple-local-avatars.php @@ -283,9 +283,6 @@ public function get_avatar_data( $args, $id_or_email ) { $args['url'] = $default_url; } elseif ( 'simple_local_avatar' === $avatar_default ) { $args['default'] = $default_url; - } else { - $args['url'] = $default_url; - } } if ( ! empty( $args['url'] ) ) { From ec519b9b67cfdde59b48ff512cb89af2f2645c30 Mon Sep 17 00:00:00 2001 From: faisal-alvi Date: Wed, 15 May 2024 16:49:54 +0530 Subject: [PATCH 3/3] add missing parenthesis --- includes/class-simple-local-avatars.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/class-simple-local-avatars.php b/includes/class-simple-local-avatars.php index 829e382..f7fe83d 100644 --- a/includes/class-simple-local-avatars.php +++ b/includes/class-simple-local-avatars.php @@ -283,6 +283,7 @@ public function get_avatar_data( $args, $id_or_email ) { $args['url'] = $default_url; } elseif ( 'simple_local_avatar' === $avatar_default ) { $args['default'] = $default_url; + } } if ( ! empty( $args['url'] ) ) {