Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Created November 20, 2017 08:15
Show Gist options
  • Select an option

  • Save andrewlimaza/1e7c8bdd9675cf5a83e3c64b74c13272 to your computer and use it in GitHub Desktop.

Select an option

Save andrewlimaza/1e7c8bdd9675cf5a83e3c64b74c13272 to your computer and use it in GitHub Desktop.
require level before signing up.
/*
Require a certain level before registering for another level.
Add this code to your active theme's functions.php or
a custom plugin.
*/
function my_pmpro_registration_checks($okay)
{
//only check if things are okay so far
if($okay)
{
global $pmpro_level;
if($pmpro_level->id == 10 && !pmpro_hasMembershipLevel( array( '1','2','3','4','5' ) )
{
pmpro_setMessage("You must be a free member first before registering for this level.", "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