Last active
September 30, 2019 10:53
-
-
Save femiyb/b63f5c78806aa2e4de90ea06cd182b43 to your computer and use it in GitHub Desktop.
Disable Registration based on Register Helper field value
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
<?php | |
/* | |
Disable Registration based on Register Helper field value | |
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(isset($_REQUEST['not_permitted']) && $_REQUEST['not_permitted'] == 'yes') | |
{ | |
pmpro_setMessage("You are not permitted to register 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