Created
May 28, 2019 18:11
-
-
Save messica/4e45e1532cc5fc06971a4e7b762e3dac to your computer and use it in GitHub Desktop.
Don't apply set expiration date if renewing.
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 | |
// Don't apply set expiration date if renewing. | |
function my_pmpro_checkout_level( $checkout_level ) { | |
// Get current level. | |
$user_level = pmpro_getMembershipLevelForUser(); | |
if ( ! empty( $user_level ) && $user_level->id == $checkout_level->id ) { | |
// Remove Set Expiration Date filters. | |
remove_filter("pmpro_checkout_level", "pmprosed_pmpro_checkout_level"); | |
remove_filter('pmpro_discount_code_level', 'pmprosed_pmpro_checkout_level', 10, 2); | |
remove_filter('pmpro_ipnhandler_level', 'pmprosed_pmpro_checkout_level'); | |
} | |
return $checkout_level; | |
} | |
add_filter( 'pmpro_checkout_level', 'my_pmpro_checkout_level', 5 ); | |
function my_pmpro_level_expiration_text( $text, $checkout_level ) { | |
// Get current level. | |
$user_level = pmpro_getMembershipLevelForUser(); | |
if ( ! empty( $user_level ) && $user_level->id == $checkout_level->id ) { | |
// Remove Set Expiration Date filters. | |
remove_filter('pmpro_level_expiration_text', 'pmprosed_pmpro_level_expiration_text', 10, 2); | |
} | |
} | |
add_filter( 'pmpro_level_expiration_text', 'my_pmpro_level_expiration_text', 5, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment