Charitable Documentation

Learn how to make the most of Charitable with clear, step-by-step instructions.

Charitable_User

The Charitable_User class allows you to get access to information about a particular user.

Charitable_User is a sub-class of WP_User.

Getting an instance of Charitable_User

Given a user ID, you can retrieve a Charitable_User instance in one of two ways:

$user_id = 123;

// Get instance from cache
$user = charitable_get_user( $user_id );

// Direct instantiation
$user = new Charitable_User( $user_id );

The advantage of using charitable_get_user is that it uses the object cache to retain the instance of Charitable_User.

Properties

Charitable_User has access to all the same properties as WP_User:

https://codex.wordpress.org/Class_Reference/WP_User

Methods

get_donor_id()

Returns the donor ID for this user. If this user has never donated, this will return false.

get_donor()

This returns a single record from the wp_charitable_donor table for the donor.

is_donor()

This returns whether the user is a donor.

is_verified()

This returns whether the user has verified their email address.

mark_as_verified( $verified )

This sets whether the user’s account is verified.

Params
$verified
Boolean. Whether the user’s account is verified.

get_email()

Returns the user’s email address.

get_name()

Returns the user’s full name. Note that if the user has not supplied a first name, only the last name will be returned; and vice versa.

get_first_name()

Returns the user’s first name.

get_last_name()

Returns the user’s last name.

get_location()

Returns the user’s location.

If available, this will show the user’s city, followed by their country; if a city is not set, it will show the user’s state, followed by their country. If neither a city nor state is shown, this will return the user’s country.

If no country is set, just the city or state will be shown.

get_address( $donation_id = '' )

Returns the printable address of the user. If a donation id is specified, this will return the address used for the donation.

Params
$donation_id
Optional. If set, this will return the address for the donation. Otherwise, this will return the address stored in the donor’s profile.

get_donations( $distinct_donations = false)

This will return an array of all donations made by the user.

Params
$distinct_donations
Boolean. If true, this will only show unique donations.

count_donations( $distinct_donations = false)

This returns the number of donations made by the donor.

Params
$distinct_donations
Boolean. If true, this will only count unique donations.

count_campaigns_supported()

This returns the number of campaigns to which the user has donated.

get_total_donated( $campaign_id = false )

Returns the total amount donated by the user, or the total donated to a particular campaign by the user.

Params:
$campaign_id
Optional. If set, this will only get the total amount donated by the donor to the given campaign. By default, this is set to false.

get_avatar( $size = 100 )

Returns the HTML to display the donor’s avatar. By default, this will return the Gravatar associated with the donor’s email address.

Params
$size
Optional. Sets the width & height of the avatar to return. By default, the avatar is returned with a width and height of 100px.

get_avatar_src( $size = 100 )

Returns the image source file of the avatar.

Params
$size
Optional. Sets the width & height of the avatar to return. By default, the avatar is returned with a width and height of 100px.

get_campaigns( $args = array() )

Returns a WP_Query object with all campaigns created by the donor.

Params
$args
Optional. Additional arguments to be passed to WP_Query.

get_current_campaigns( $args = array() )

Returns a WP_Query object with all campaigns created by the donor that are currently active.

Params
$args
Optional. Additional arguments to be passed to WP_Query.

has_current_campaigns()

Returns whether the donor has any current campaigns.

get_activity( $args = array() )

Returns a WP_Query object with all donations and campaigns created by the donor, ordered by date.

Params
$args
Optional. Additional arguments to be passed to WP_Query.

Still have questions? We’re here to help!

Last Modified:

What's New In Charitable

🔔 Subscribe to get our latest updates
📧 Subscribe to Emails

Email Subscription

Join our Newsletter

We won’t spam you. We only send an email when we think it will genuinely help you. Unsubscribe at any time!

Donations Live New

👉🏻 Showcase Real Momentum with the Donations Feed

Give your donors a reason to trust. Our new feed lets you display a living, breathing record of people showing up for your cause.

🤝 Build instant trust: Overcome donor hesitation by showing a proven track record of community support.
💬 Highlight donor stories: Display real donor comments and locations to show the human side of your fundraising.
🛠️ Drop it anywhere: Easily add the block to your homepage, campaign pages, or confirmation screens in seconds.
📈 Curate your feed: Group multiple donations from the same person or sort by highest amounts to encourage larger gifts.

Campaigns New

🎨 Campaign Showcase: Pro Level Display, No Coding Needed.

Display your causes with style and make it easier than ever for donors to find the right campaign. We are excited to announce the brand-new Campaign Showcase, a powerful, no-code tool designed to help you create beautiful, high-converting campaign grids and carousels.

The Ultimate Discovery Experience

Your mission deserves to be seen. With the Campaign Showcase, you can move beyond simple lists and create dynamic displays that highlight your most urgent needs, helping donors connect with the causes they care about most.

⚡ No-Code Customization: Effortlessly change layouts, columns, and styles with a single click. Whether you want a clean grid or an interactive carousel, you can match your organization’s look without any CSS or JavaScript.

🎯 Advanced Search & Filter: Empower your supporters with real-time filtering. Donors can quickly sort through campaigns by tags, popularity, or “ending soon,” making it easy to find exactly where their help is needed.

💰 Quick Donate Integration: Boost your conversions with instant giving. The Showcase allows donors to contribute via a modal popup directly from the display, featuring pre-selected amounts for a faster, friction-free experience.

Addon New

🤯 New Addon: Campaign Updates

Keep your supporters informed and engaged with every step of your progress! Share the ongoing impact of your mission and build lasting trust with your donor community!

The Ultimate Engagement Tool

Fundraising is a journey, not a one-time event. Now, you can easily provide real-time updates directly on your campaign pages, ensuring your donors stay connected to the causes they care about most.

📣 Easy Storytelling: Quickly post text updates, milestones, or field reports to show exactly how donations are being put to work, keeping the momentum alive throughout your fundraiser.

🏗️ Visual Builder Integration: Seamlessly add the Updates block anywhere on your page using our drag-and-drop builder, or use a simple shortcode to display news in widgets and sidebars.

📩 Build Donor Trust: By consistently sharing progress and success stories, you create a transparent giving experience that encourages recurring support and deeper community involvement.

Integration New

Build Beautiful Fundraising Pages Visually with WPBakery Integration

We are excited to announce our brand-new integration with WPBakery, one of the most popular WordPress page builders, designed to help you create stunning layouts for your campaigns without touching a single line of code.

The Ultimate Design Experience

Designing your nonprofit’s website should be as simple as your mission is powerful. Now, you can bring Charitable functionality directly into your WPBakery workflow, using native elements to build high-converting donation pages and campaign grids in seconds.

🖱️ Drag-and-Drop Building: Easily add donation forms, campaign progress bars, and “Donate Now” buttons to your layouts using the WPBakery elements you already know and love.

🎨 Total Creative Control: Customize the look and feel of your fundraising elements using WPBakery’s native design options. Adjust margins, padding, and borders to ensure your campaigns fit perfectly with your site’s branding.

📱 Seamlessly Responsive: Every element is built to be fully responsive and mobile-friendly, ensuring your donors have a smooth, professional experience whether they are giving from a phone, tablet, or desktop.

Integration New

🖼️ Add Image Galleries to Fundraising Campaigns With Envira Gallery

Showcase the impact of your mission like never before. We are excited to announce our brand-new integration with Envira Gallery, the best WordPress gallery plugin, designed to help you tell your story through powerful, high-performance visuals.

The Ultimate Storytelling Experience

A picture is worth a thousand words – and now, it’s worth even more for your fundraising. Connect your visual impact directly to your cause by creating stunning, responsive galleries that engage donors and drive contributions.

🖼️ Visual Impact: Easily create beautiful, fast-loading galleries to show your nonprofit’s work in action, from field reports to event highlights.

🔗 Seamless Connection: Link gallery images directly to your fundraising campaigns, making it effortless for inspired visitors to go from viewing a photo to making a donation.

📱 Perfectly Responsive: Whether your donors are on a phone, tablet, or desktop, your galleries will look professional and load lightning-fast, ensuring a smooth experience on every device.