Created
October 21, 2019 19:24
-
-
Save dparker1005/bb98b600d350e6db6ed6b5aaa9e61b71 to your computer and use it in GitHub Desktop.
Remove 'Renew' link and prevent checkout if user already has membership 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 | |
// Copy from below here. | |
add_action('pmpro_is_level_expiring_soon', '__return_false', 10, 2); | |
// Prevent registration and display error message when checking out | |
// for level that the user already has. | |
function my_pmpro_prevent_renewal( $continue ) { | |
global $pmpro_level; | |
if ( pmpro_hasMembershipLevel( $pmpro_level->id ) ) { | |
$continue = false; | |
pmpro_setMessage( 'You have already have this level.', 'pmpro_error' ); | |
} | |
return $continue; | |
} | |
add_filter( 'pmpro_registration_checks', 'my_pmpro_prevent_renewal' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment