Use this hook to execute custom code after a user’s membership level is changed or cancelled. This hook passes the new level ID, the user ID of the WordPress user, and the level ID being cancelled (if specified).
do_action( 'pmpro_after_change_membership_level', int $level_id, int $user_id, int $cancel_level );
Note: In cases where there may be multiple level changes during the same page load (e.g. when expiring many members at once or when using the Multiple Memberships per User add on) you may want to use the pmpro_after_all_membership_level_changes action hook, which only fires once per page load.
- int; the level ID being changed to
- int; the user ID whose level is changing
- int; the level ID of the level being cancelled if specified
SourceView in Source Code
Related Articles and Recipes
Using Subscription Delays Add On for One-Time, Credit Card Required Trials By Kimberly Coleman
Automatically Approve Previously Approved Members By Andrew Lima
Send the New User Email to Members Added via Zapier By Travis Lima
Create and Manage Affiliates by Membership Level Using AffiliateWP By Kimberly Coleman
Set a Member Author’s Posts to Draft When Membership is Cancelled By Kimberly Coleman
Apply a BuddyPress “Member Type” on Membership Checkout or Level Change By Kimberly Coleman
Change Membership Level on Cancellation or Expiration By Kimberly Coleman
Offer Trial Memberships That Can Only Be Used Once By Andrew Lima