Created
August 3, 2018 11:41
-
-
Save andrewlimaza/0413c72c1d4db9098bbaa7927c27247a to your computer and use it in GitHub Desktop.
Change membership level when a user expires
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Set a default membership level when a user expires (only). | |
| * This does not set the default level when a user cancels. | |
| * Add this code to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function pmpro_set_default_level_only_when_expiring( $user_id, $level_id ) { | |
| pmpro_changeMembershipLevel( 1, $user_id ); // Change this to default level. | |
| return $user_id; | |
| } | |
| add_filter( 'pmpro_membership_post_membership_expiry', 'pmpro_set_default_level_only_when_expiring', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment