strangerstudios / pmpro-gift-levels

Allow members to purchase gift codes for membership at checkout.
https://www.paidmembershipspro.com/add-ons/pmpro-gift-levels/
7 stars 12 forks source link

Stripe users lose their subscription again... #32

Closed jayjay91 closed 3 years ago

jayjay91 commented 3 years ago

Describe the bug V 0.3: "BUG FIX: Fixed bug where Gift Levels was not working with Stripe checkout for existing users. Users are no longer given an expiration date 3 days in the future."

This is precisely what is happening again since version 0.4.

To Reproduce Steps to reproduce the behavior: Use Stripe to get norma subscription Buy gift subscription

dparker1005 commented 3 years ago

I am doing some research into the history of this bug and keeping some notes here for the future. Here is the original GitHub issue for this bug: https://github.com/strangerstudios/pmpro-gift-levels/issues/8

Here are all of the commits in v0.4: Avoid warning...

Change in discount code generation...

Changes filter that old membership is given back on...

Localization...

Analysis One of those commits is particularly interesting since it essentially undoes a commit that was previously added in v0.3, when the change log says that this issue was resolved for Stripe: Original fixes:

Commit that undoes those commits:

Resolution I have confirmed that changing add_action('pmpro_checkout_before_change_membership_level', 'pmprogl_pmpro_checkout_before_change_membership_level', 1); to add_action('pmpro_checkout_before_processing', 'pmprogl_pmpro_checkout_before_change_membership_level', 1); resolves this issue for Stripe, though it would likely cause the PayPal issue again. More work will be needed to fix resolve this issue for both gateways at once, though I have put together a code recipe that will fix this behavior for Stripe in the meantime: https://gist.github.com/dparker1005/1012fe4e6975d0a4220919ea66d5b848