Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save 1wdtv/a6d8a45979e4e217d212 to your computer and use it in GitHub Desktop.

Select an option

Save 1wdtv/a6d8a45979e4e217d212 to your computer and use it in GitHub Desktop.
<?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