Skip to content

Instantly share code, notes, and snippets.

@strangerstudios
Created April 14, 2015 16:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save strangerstudios/4f22325d60fbeb60b9d9 to your computer and use it in GitHub Desktop.
Save strangerstudios/4f22325d60fbeb60b9d9 to your computer and use it in GitHub Desktop.
Require a certain level before registering for another level with Paid Memberships Pro.
/*
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 == 2 && !pmpro_hasMembershipLevel(1))
{
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");
@laurenhagan0306
Copy link

This recipe is included in the blog post on "Require a Specific Level to Allow Registration for Another Level" at Paid Memberships Pro here: https://www.paidmembershipspro.com/require-a-specific-level-to-allow-registration-for-another-level/

@kimcoleman
Copy link

This recipe is included in the blog post on "Require a Specific Level to Allow Registration for Another Level" at Paid Memberships Pro here: https://www.paidmembershipspro.com/require-a-specific-level-to-allow-registration-for-another-level/

The post on our site is no longer active. Our recommended approach is to use the Approval Process for Membership Add On here: https://www.paidmembershipspro.com/add-ons/approval-process-membership/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment