CiviCRM token to list and total donation from the previous calendar year, spouse’s donations included

Here’s a zip file of the php code to define a token that creates a small table showing all donations made by any contact during the previous calendar year, including donations made by a spouse. If there is no spouse, the spouse names are not included in the token’s output. 

The token does it’s own queries to find contributions and will produce the same table if called for either spouse.  It can be used to generate individual thank-you letters (or emails) directly from a contact summary page, or multiple letters/emails from the results of a contact search.

I added the above code to my WordPress child theme’s functions.php. The exact method for registering the hooks is slightly different for non-wordpress systems

Sample output when the contact has a spouse:

Sample output when the contact has no spouse:

May 19 2016  Utilities and Notes
Center Aligning Tweets Embedded With WordPress Auto-Embed (Also Works Universally on Any Site)
Updated: August 17, 2022 — 1:38 pm

The Author

Don Alejandro

Don is a renegade physicist who manages website software for several local groups from an undisclosed location in the woods of West Virginia...

Leave a Reply

Your email address will not be published. Required fields are marked *

Send this to a friend