Skip to content

Conversation

@pauloiankoski
Copy link
Contributor

@pauloiankoski pauloiankoski commented Nov 20, 2025

Resolves GIVE-2971

Description

This PR fixes an issue where the Campaign Donations and Campaign Donors blocks were attempting to display donor avatars based on their WordPress User account. However, not all donors have associated WordPress User accounts, which caused avatar display issues.

The solution updates both blocks to:

  • Query the give_donormeta table to retrieve the avatarId meta value directly from the donor profile
  • Use wp_get_attachment_image_url() to display the avatar when an avatarId is found
  • Fall back to email-based avatars (via get_avatar_url()) when no custom avatar is set
  • Maintain the existing anonymous donor handling

This ensures that all donors, regardless of whether they have a WordPress User account, can have their custom avatars displayed correctly in the Campaign blocks.

Affects

  • Campaign Donations block: Donor avatar display in donation listings
  • Campaign Donors block: Donor avatar display in donor listings
  • Both blocks now query the give_donormeta table for avatar information

Visuals

CleanShot 2025-11-20 at 12 08 29

Testing Instructions

  1. Create a campaign with the Campaign Donations and/or Campaign Donors blocks
  2. Make donations from donors with custom avatars set in their donor profiles (stored in donormeta)
  3. Make donations from donors without custom avatars set in their donor profiles
  4. Make donations from donors without WordPress User accounts
  5. Verify that avatars display correctly for all donors:
    • Donors with custom avatars should show their custom avatar
    • Donors without custom avatars should show email-based avatars or default WP picture
    • Anonymous donations should show the default anonymous avatar

Pre-review Checklist

  • Acceptance criteria satisfied and marked in related issue
  • Relevant @unreleased tags included in DocBlocks
  • Includes unit tests
  • Reviewed by the designer (if follows a design)
  • Self Review of code and UX completed

@pauloiankoski pauloiankoski changed the title Fix: Update Campaign blocks to use donor profile avatar from donormeta table Fix: Update Campaign blocks to use donor profile avatar Nov 20, 2025
@pauloiankoski pauloiankoski marked this pull request as ready for review November 20, 2025 15:10
@pauloiankoski pauloiankoski requested a review from alaca December 8, 2025 16:18
Copy link
Member

@alaca alaca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, Paulo 👍
Please resolve merge conflicts before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants