I finished the new Funds interface and have a routine that converts legacy funds data into the custom post type we’re using from here on. Seamless Donations 4.0 implements custom post types for funds, donations, and donors. In earlier versions, only donations had its own custom post type. Funds existed in an array set as an option and donors were extrapolated from the donation data when needed.
By implementing funds and donors as custom post types as well, the entire WordPress interface can be used to deal with that data (including themes and other plugins), rather than having it trapped within some options arrays.
Each donation post now stores the ID of a donor and each donor has a list of IDs of donations. That makes it much easier (and faster) to cross-reference donor and donation data.
Data migration routines have been completed that migrate the old donor, funds, and donation data into the new structure. Old data is not deleted at this time. While the migration code works, I haven’t yet decided when it will run and exactly how the user will be informed of a migration.
The interface now adds three menus at the top-level of the Admin dashboard: Donations, Donors, and Funds. The settings dashboard of Seamless Donations still has tabs for each of these three items, but those tabs are likely to either be removed or replaced with just empty space and instructions for existing users pointing them on where to find the new features.
Potential breakage for existing users
Users just using the plugin should have no problem with the new 4.0 version of the plugin. However, users who have tinkered a bit with the plugin innards might encounter some gotchas that will need converting. Here are a few things that will be necessary to watch out for.
- Pre-4.0 Seamless Donations used a ‘dgx-donation’ custom post type for donations. This has been renamed to ‘donation’. It turns out that some of the frameworks barf on custom post type names with hyphens in them. So if you use something that looks for a custom post type of ‘dgx-donation’, you’ll need to change that to ‘donation’.
- Because 4.0 implements custom post types for donors and funds, it is possible that if your code looks for that information as a meta value, it will break.
Admin forms validation filter
Built a new filter that can process admin form validations for any button pressed in the Seamless Donations admin UI. The filter is validate_page_slug_[page_slug_name]. For example, if a page’s slug is seamless_donations_funds, it calls the filter validate_page_slug_seamless_donations_funds. The filter takes three parameters:
- the array of data submitted with the form
- the array of data already in the database associated with the form
- the setup object, which is the class (for things like setting error messages)
In the new donor and donation custom post types, have a number of new filters that get processed:
- seamless_donations_donors_type_setup: passes the taxonomy array for setup
- seamless_donations_donations_type_setup: passes the taxonomy array for setup
- seamless_donations_donors_setup: passes the custom post type array for setup
- seamless_donations_donations_setup: passes the custom post type array for setup
- seamless_donations_donor_header_style: passes CSS that helps customize the donor list header
- seamless_donations_donation_header_style: passes CSS that helps customize the donation list header
- seamless_donations_donor_header_array: passes an array that contains the name of the donor list header fields
- seamless_donations_donation_header_array: passes an array that contains the name of the donation list header fields
A quick note on PayPal sandbox testing
I needed to spin up a test site outside of my local development environment. If you think about it, this makes sense. PayPal has to be able to route a response back to the originating server, and if the originating server is a local development machine, that’s not going to work without a lot of futzing. There’s a good thread on using the Sandbox in the support forum.