Give 2.0 Donor and User Meta Database Updates Explained

We want to keep everyone in the loop with what’s going on with the database updates within Give 2.0 which is now moving into the final testing phase. These are the following donor related updates we are doing in Give version 2.0 with backward compatibility:

  1. The donor related tables is renamed:
    1. {wp-prefix}_give_customer → {wp-prefix}_give_donor
    2. {wp-prefix}_give_customermeta → {wp-prefix}_give_donormeta
  2. The Give_Customer class is deprecated. Use the Give_Donor class instead.
  3. We are only storing donor ID to payment meta instead of user ID.
  4. Moving forward we are going to store donor metadata to {wp-prefix}_give_donormeta instead of WP’s {wp-prefix}_usermeta
    1. Current donor metadata stored in the usermeta table will be copied to the donormeta table using an upgrade routine.
    2. Previous donor metadata stored in the usermeta table will not be deleted. This is for backwards compatibility and a failsafe should the data migration be interrupted.
  5. Address updates:
    1. The donor’s billing address is currently (pre-2.0) only being saved to the donation payment meta. Moving forward in 2.0 the data is now saved to both the payment meta and the donor meta.
    2. If a repeat donor returns and enters a different billing address then it will save like before to the payment meta and add the new address to donormeta. In this case, the new address would be called “Billing Address 2” within the donor’s profile.
    3. The donor can now have multiple types for addresses.
      1. Add-on like Gift Aid will now store the additional “Gift Aid Address” to the donor meta.
      2. This paves the road for the future enhancement of allowing the donor to have both a billing address and physical address should admins want to collect the additional information.
    4. You can access all donor addresses from the Give_Donor object.
  6. A Give_Donor can connect to a WP_User for a variety of reasons including, but not limited to:
    1. Providing the user access to donors by using WordPress core functionality
    2. To increase the extensibility of Give with third-party plugins that creates user roles. Examples include:
      1. Membership plugins
      2. LMS platforms (course, study material)
      3. Content restriction plugins   
      4. Ecommerce platforms

If you have any questions be sure to ping us in our Slack community or in the comments!

 

Devin Walker

Head of Product and Founder of GiveWP, WordPress enthusiast, WordCamp speaker, mediocre golfer, post-rock obsessed cat lover and aspiring world traveler.

 

2 thoughts on “Give 2.0 Donor and User Meta Database Updates Explained

  1. Does this changes the way we add our own custom fields through code? Specifically, do we need to start changing our code to put custom fields into separate donormeta key value pairs or do we still put them in a single payment_meta array that is simply moving from usermeta to donormeta?

    Be sure to put big, obvious warnings in the change log and elsewhere when 2.0 comes out so customers who have custom code for form fields don’t unknowingly break anything before consulting with their development partners.

    1. Hey Scott – great question. I’ve just published the following article which should help answer your question: https://developers.givewp.com/2017/12/08/give-2-0-database-updates-explained/

      Moving forward, we recommend you store each meta value within it’s own meta key. Regardless of whether it’s payment or donor meta. In 2.0 we are breaking apart the payment_meta array into separate key/value pairs.

      We’ll be sure to put some obvious warnings in the change log and here, social media, youtube, shout it from the rooftops, etc prior to release. 🙂

Leave a Comment