Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
Created January 25, 2014 18:17
Show Gist options
  • Save strangerstudios/8620962 to your computer and use it in GitHub Desktop.
Save strangerstudios/8620962 to your computer and use it in GitHub Desktop.
Don't let existing members downgrade example.
/*
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