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);
Note: A better hook to use, especially in the case that there are multiple membership levels changing at once, is the pmpro_after_all_membership_level_changes action hook, which only fires once per page load.
Parameters
- $level_id
- int; the level ID being changed to
- $user_id
- int; the user ID whose level is changing
Source
File: https://github.com/strangerstudios/paid-memberships-pro/blob/master/includes/functions.php
View in Source CodeRelated Articles and Recipes
Offer Trial Memberships That Can Only Be Used Once By Sam Daugherty
Using Subscription Delays Add On for One-Time, Credit Card Required Trials By Kim Coleman
Automatically Approve Previously Approved Members By Andrew Lima
Send the Membership Confirmation Email When the Admin Changes a Member’s Level By Jason Coleman
Send the New User Email to Members Added via Zapier By Travis Lima
Hide Pending or Denied Members from your Member Directory and Frontend Profile Page By Andrew Lima
Create and Manage Affiliates by Membership Level Using AffiliateWP By Kim Coleman
Set a Member Author’s Posts to Draft When Membership is Cancelled By Kim Coleman
Apply a BuddyPress “Member Type” on Membership Checkout or Level Change By Kim Coleman
Change Membership Level on Cancellation or Expiration By Kim Coleman
About Actions and Filters in PMPro
Hooks allow you to extend Paid Memberships Pro without editing any core plugin files. You can use a hook to program custom code that interacts with or modifies code in our plugin, Add Ons, your theme, and even WordPress itself.
There are two kinds of hooks: actions and filters.
- Action hooks allow you to run new custom code at pre-defined locations.
- Filter hooks allow you to change or extend existing code by modifying the data and returning it back to the software.
Click here to browse the full database of action and filter hooks available in Paid Memberships Pro. For help extending our Add Ons, refer to the individual Add On's documentation page for a list of available hooks.
For more developer-focused information about Paid Memberships Pro, check out the advanced developer topics documentation.