The link you paste request i upgrade my membership further before seeing the code. Below is the code i’m using
******************************************************************************************
function my_pmpro_registration_checks_require_code_to_register($pmpro_continue_registration)
{
//only bother if things are okay so far
if(!$pmpro_continue_registration)
return $pmpro_continue_registration;
//level = 1, 3 and there is no discount code, then show an error message
global $pmpro_level, $discount_code;
//if($pmpro_level->id == 1, 3 && (empty($discount_code) || $discount_code != “REQUIRED_CODE”)) //use this conditional to check for a specific code.
if($pmpro_level->id == 1 && empty($discount_code) || $pmpro_level->id == 2 && empty($discount_code))
{
pmpro_setMessage(“You must use a valid Discount Code to register on this site.”, “pmpro_error”);
return false;
}
return $pmpro_continue_registration;
}
add_filter(“pmpro_registration_checks”, “my_pmpro_registration_checks_require_code_to_register”);
function theme_ob_get_clean() {
global $theme_ob_stack;
ob_end_flush();
return array_pop($theme_ob_stack);
}
*************************************************************************************
I’m able to bypass discount code restriction, by just entering any figures in the Discount Code field, don’t click on apply and click on “Submit and Checkout” twice it will redirect the user to confirmation and assign a membership level.
***
I think there should be an addition code that will verify the code entered in the Discount code field even if not apply.
-
This reply was modified 8 years, 4 months ago by
maundinc.