Forked from mrkellysch/my_pmpro_registration_checks.php
Last active
August 29, 2015 14:19
-
-
Save 1wdtv/a6d8a45979e4e217d212 to your computer and use it in GitHub Desktop.
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 | |
| /* | |
| Plugin Name: PMPro stop downgrade level | |
| Plugin URI: https://gist.github.com/1wdtv/a6d8a45979e4e217d212 | |
| Description: Prevent existing paid members from downgrading to free level (eg: when registering from a webinar). | |
| Version: 1 | |
| Author: 1WD.tv | |
| Author URI: https://1wd.tv | |
| */ | |
| /* | |
| Don't let exisisting members checkout for free level. | |
| */ | |
| function free_pmpro_registration_checks($okay) | |
| { | |
| //only check if things are okay so far | |
| if($okay) | |
| { | |
| global $pmpro_level; | |
| if(pmpro_hasMembershipLevel() && $pmpro_level->id == 20) | |
| { | |
| pmpro_setMessage("You already have an paid account. If you wish to cancel, please go into your <a href="/my-account">dashboard</a>", "pmpro_error"); | |
| $okay = false; | |
| } | |
| } | |
| return $okay; | |
| } | |
| add_action("pmpro_registration_checks", "free_pmpro_registration_checks"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment