strangerstudios / pmpro-sponsored-members

Generate a discount code for a main account holder to distribute to sponsored members.
https://www.paidmembershipspro.com/add-ons/pmpro-sponsored-members/
15 stars 27 forks source link

Child users who cancel their own membership are not removed from parent's list of sponsored accounts #136

Open dparker1005 opened 1 year ago

dparker1005 commented 1 year ago

Describe the bug When a child account cancels their membership from their dashboard, their seat doesn’t get removed from their parent’s account (it will still say 1/however many uses and show the account username). Then, if the parent tries to remove the seat manually from their dashboard, it won’t remove, it gets stuck. The plugin works as expected when the parent is the one to remove the child first.

The ideal fix here is likely to hook into the PMPro cancellation process specifically and remove the discount code use in this case.

It may seem better to always remove the use whenever the child user's membership is removed, but there are edge cases here. For example, in cases when a parent user's membership is removed (and therefore all of their children's memberships), we don't want to remove the discount code use here so that we can re-activate child accounts when the parent registers as a sponsor again.

Isolating the problem (mark completed items with an [x]):

WordPress Environment

``` Please share non-sensitive information about your hosting environment such as WordPress version, PHP version, Paid Memberships Pro and any related plugins versions. ```