Give

How to Query Donor Information

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

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

Getting Donors from Your GiveWP Database

The key to getting donors from your database is using the Give_Donors_Query class.

Understanding all the data you can Query for Donors

Often the easiest way to query data is to see a dump of the data to be able to customize the query. In the above snippet you pulled the name for each donor with $donor->name object/key.

The following snippet will similarly query the GiveWP Donor Object, but instead of returning 20 Donors, it will return one donor, and all of the various attributes of that object.

Conclusion

That gives you a starting point to pull any data you’d like for Donors from your GiveWP database.

Filed under Developer Docs
Last updated: October 19, 2015
Was this page helpful?
Thanks for the feedback!