| @@ -160,28 +160,16 @@ | ||
| 160 | 160 | return trim("{$fname} {$lname}"); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
| 164 | - * Accessor method to get the user's avatar URL using their email, | |
| 165 | - * with a size of 100x100 pixels. | |
| 166 | - * | |
| 167 | - * @return string | |
| 164 | + * The customer's avatar URL: their uploaded photo when one is set, | |
| 165 | + * otherwise the WordPress avatar by user id or email. Empty when the | |
| 166 | + * customer has no avatar of their own — every display site falls back | |
| 167 | + * to a placeholder icon rather than Gravatar's stock image. | |
| 168 | 168 | */ |
| 169 | - public function getPhotoAttribute() | |
| 169 | + public function getPhotoAttribute(): string | |
| 170 | 170 | { |
| 171 | - // Get the custom photo URL from user meta using the user_id of this instance | |
| 172 | - $customPhotoUrl = get_user_meta($this->user_id, 'fc_customer_photo_url', true); | |
| 173 | - | |
| 174 | - // Sanitize the customer photo URL | |
| 175 | - $customPhotoUrl = esc_url($customPhotoUrl ?? ''); | |
| 176 | - | |
| 177 | - // Return the custom photo URL if it exists, otherwise fallback to Gravatar | |
| 178 | - if (!empty($customPhotoUrl)) { | |
| 179 | - return $customPhotoUrl; | |
| 180 | - } | |
| 181 | - | |
| 182 | - // Fallback to Gravatar if no customer avatar is set and sanitize the Gravatar URL | |
| 183 | - return esc_url(get_avatar_url($this->email, ['size' => 100])); | |
| 171 | + return Helper::getUserAvatarUrl($this->user_id, $this->email); | |
| 184 | 172 | } |
| 185 | 173 | |
| 186 | 174 | /** |
| 187 | 175 | * Accessor method to get the country's name with country code, |