Created
June 14, 2019 00:30
-
-
Save messica/39411d82d50fd9efab56159c5b896cc3 to your computer and use it in GitHub Desktop.
Remove trial if user has cancelled order for same level.
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 | |
/** | |
* Remove trial if user has cancelled order for same level. | |
* Add code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function pmpro_remove_trial_for_existing_members( $level ) { | |
$order = new MemberOrder(); | |
if ( $order->getLastMemberOrder( null, 'cancelled', $level->id ) ) { | |
$level->trial_limit = 0; | |
} | |
return $level; | |
} | |
add_action( 'pmpro_checkout_level', 'pmpro_remove_trial_for_existing_members' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment