Created
June 14, 2019 17:24
-
-
Save dparker1005/db9f53119e278d2a78bcd25a34fc906a to your computer and use it in GitHub Desktop.
When a user's level is changed to not have a membership, instead give them the free level
This file contains 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 | |
function my_pmpro_after_change_membership_level( $level_id, $user_id ) { | |
// TODO: Replace '1' with level id of free level | |
$free_level = 1; | |
if ( $level_id == 0 && empty( $_REQUEST['delete_account'] ) ) { | |
//cancelling, give them level 1 instead | |
pmpro_changeMembershipLevel( $free_level, $user_id ); | |
} | |
} | |
add_action("pmpro_after_change_membership_level", "my_pmpro_after_change_membership_level", 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment