Hi,
If you could help me understand the purpose of using the two hooks (as in, what are you trying to do with the level information, and where are you using the pmpro_changeMembershipLevel()
function which triggers them), I may be able to propose a way to achieve what you’re trying to do.
The pmpro_changeMembershipLevel()
function knows what to do with 3 different versions of the $level variable:
The membership level object in the form of an array()
,
an integer (the presumed level ID), or
null (set whatever level the specified or current_user has to false).
For the ID (#) of the level, when passing it to the pmpro_changeMembershipLevel()
from the checkout process, we use membership_id
for the level id.
If you’re wanting to use the actions in the context of the checkout page, it may be more appropriate to use the pmpro_checkout_before_change_membership_level
action and the pmpro_after_checkout
actions?
Ok, I will try to explain the scenario, I am using PMPRo membership for a custom functionality where I attach a custom objects with Membership Level IDs. It is multi to multi relationship.
Now, when a user changes his membership, I need to remove only the unchanged objects as every object also has a state associated with it which I do not want to change.
The checkout hooks work good except they will not work when admin changes the membership from WP Admin panel or when the user membership Expires OR any other PMPro add on affect the membership status of a user.
Correction in previous reply :
I need to remove only the unchanged objects
should be
I need to remove only the changed objects
Any progress on this ? This is a very big issue in Paid Memberships Pro, as the hook is clearly incapable of getting old membership levels. The old membership levels give the new membership level and hence makes the hook useless for anyone to use.
Please I beg the authors to check the screenshot : http://prntscr.com/bga9n4
Unfortunately, we will have to start recommending other membership plugins because the response on this issue have been dismal.