Created
April 14, 2015 16:08
-
-
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.
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
/* | |
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"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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/