Often times you may want to display donor information on your website from Give. The following will demonstrate how to do this using Give’s core classes. Keep in mind, not all donors want their information displayed publicly.

Getting Donors from Your Give Database

The key to getting donors from your database is using the Give_DB_Customers class. We refer to donors as “customers” within the development of Give because of it’s roots as an ecommerce platform and to keep in line with convention. This class is initialized when Give is loaded, so you can make sure of it’s methods right away.

NOTE:  This snippet is not yet using new Give 2.0 functions. While it may still work with our deprecated code; we encourage developers to dig into using updated 2.0 functions and we’ll be updating these examples soon.

Here’s a basic query that demonstrates using the get_customer() method:

Get the latest 20 Give Donors

//Get the latest 20 Give Donors
$args = array(
	'number' => 20,
//First check that Give exist
if ( class_exists( 'Give' ) ) {
	$donors = Give()->customers->get_customers( $args );
	foreach ( $donors as $donor ) {

		//Here's the individual donor data
		echo "<pre>";
		var_dump( $donor );
		echo "</pre>";


Getting More Granular with the Query

If you look into the get_customers() method you’ll see there are a variety of arguments you can to pull donors such as:

  • Specific donor(s) data by name, ID or Email
  • Donations made within a date range
  • Latest donors

Getting Donors based on Payments

To do things like display donors based on a specific form ID. This can be achieved using a different function than mentioned above. To do this we will first query to get payments for a specific form then retrieve the donor’s information based on that payment.

List Donors for a Specific Donation Form

//Get donors based on forms IDs (can be single or multiple forms)
if(function_exists('give_get_payments')) {
	$args = array(
		'give_forms' => array(8, 888),
	$donations = give_get_payments( $args );
	foreach($donations as $donation) {

		//Now get donor information from this donation ("customer" aka "donor")
		$customer_id = give_get_payment_customer_id( $donation->ID );
		$customer    = new Give_Customer( $customer_id );
		//Here's the customer object returned with all sorts of useful data
		echo "<pre>";
		echo "</pre>";


Looking for More Donor Functions?

Check out the functions within `give/includes/user-function.php` to see if any of these fit the bill for your requirements. Functions include:

  • give_get_users_purchases( $user = 0, $number = 20, $pagination = false, $status = 'complete' ) – Retrieves a list of all purchases by a specific user.
  • give_get_purchase_stats_by_user( $user = '' ) – Retrieves the purchase count and the total amount spent for a specific user
  • give_has_purchases( $user_id = null ) – Checks to see if a user has purchased at least one item.
  • give_purchase_total_of_user( $user = null ) – Calculates the total amount spent by a user
  • give_get_users_completed_donations( $user = 0, $status = 'complete' ) – Returns a list of unique donation forms given to by a specific user