Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save mrkellysch/347625af75640a7a1198 to your computer and use it in GitHub Desktop.

Select an option

Save mrkellysch/347625af75640a7a1198 to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: PMPro stop upgrade level
Plugin URI: https://gist.github.com/strangerstudios/8620962
Description: Prevent students from upgrading to teacher level.
Version: .4.2.1
Author: Stranger Studios
Author URI: http://www.strangerstudios.com
*/
/*
Don't let exisisting members checkout for higher level.
*/
function student_pmpro_registration_checks($okay)
{
//only check if things are okay so far
if($okay)
{
global $pmpro_level;
if(pmpro_hasMembershipLevel() && $pmpro_level->id == 7)
{
pmpro_setMessage("You cannot upgrade from a student account. Please logout from the student account and signup for this level", "pmpro_error");
$okay = false;
}
}
return $okay;
}
add_action("pmpro_registration_checks", "student_pmpro_registration_checks");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment