Created
November 20, 2017 08:15
-
-
Save andrewlimaza/1e7c8bdd9675cf5a83e3c64b74c13272 to your computer and use it in GitHub Desktop.
require level before signing up.
This file contains hidden or 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 == 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