lundi 11 février 2019

Why is my IF statement not working to define membership level?

I am very new to PHP and trying to get an IF statement to work to change the membership level based on the possibility of multiple answers provided in the registration form. However, it's not working. If anyone can help me understand what I am doing wrong/missing that would be a great help. Here is my code. Thank you.

function my_pmpro_checkout_level($level)
{

if ( ! empty( $_REQUEST['registrationlevel']) && $level->id == '1' ) {
if (( $_REQUEST['registrationlevel'] == 'eligibleforlimited' && $_REQUEST['experience'] != 'morethansixyears') || ($_REQUEST['registrationlevel'] == 'eligibleforlimited' && $_REQUEST['timeassesment'] == 'no')) {
    $level->id = '3';
  } elseif ( $_REQUEST['registrationlevel'] == 'eligibleforprovisional' && $_REQUEST['experience'] != 'noexperience') {
    $level->id = '3'}
}

return $level;
}
add_filter("pmpro_checkout_level", "my_pmpro_checkout_level");

Aucun commentaire:

Enregistrer un commentaire