Forked from andrewlimaza/only-set-default-membership-level-on-expiration.php
Created
July 30, 2020 21:28
-
-
Save femiyb/3d6c17f4ce0b5dba765c32bf5fd45f74 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