Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cyberwani/9089767 to your computer and use it in GitHub Desktop.
Save cyberwani/9089767 to your computer and use it in GitHub Desktop.
/*
Don't let exisisting members checkout for free level.
*/
function my_pmpro_registration_checks($okay)
{
//only check if things are okay so far
if($okay)
{
global $pmpro_level;
if(pmpro_hasMembershipLevel() && $pmpro_level->id == 7)
{
pmpro_setMessage("Your existing level has access to everything the Free level does. If you'd still like to change your level, please <a href='/membership-cancel/'>cancel first</a>.", "pmpro_error");
$okay = false;
}
}
return $okay;
}
add_action("pmpro_registration_checks", "my_pmpro_registration_checks");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment