@openmtbmap, I went looking into the ipn_signup_vars thing, and tried a few things.
I managed to get a user without them (mostly just default empty values), demoted when ending his subscription. I’m not sure yet if those missing values would cause an issue elsewhere yet.
I may end up adding it to a release, if not as a default, maybe as an beta setting that you can enable to not require those vars in the database for the gateway notification to be acted on.
In case you want to try this for a bit…
in src/includes/classes/utils-users.inc.php find
public static function get_user_ipn_signup_vars($user_id = 0, $subscr_txn_baid_cid_id = '')
{
if($user_id || ($subscr_txn_baid_cid_id && ($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with($subscr_txn_baid_cid_id)))
|| (!$user_id && !$subscr_txn_baid_cid_id && is_object($user = wp_get_current_user()) && !empty($user->ID) && ($user_id = $user->ID))
)
{
$_subscr_baid = get_user_option('s2member_subscr_baid', $user_id);
$_subscr_cid = get_user_option('s2member_subscr_cid', $user_id);
$_subscr_id = get_user_option('s2member_subscr_id', $user_id);
if($_subscr_id && (!$subscr_txn_baid_cid_id || $subscr_txn_baid_cid_id === $_subscr_id || $subscr_txn_baid_cid_id === $_subscr_baid || $subscr_txn_baid_cid_id === $_subscr_cid))
if(is_array($ipn_signup_vars = get_user_option('s2member_ipn_signup_vars', $user_id)))
if($ipn_signup_vars['subscr_id'] === $_subscr_id)
return $ipn_signup_vars;
}
return FALSE; // Otherwise, return false.
}
and replace it with
public static function get_user_ipn_signup_vars($user_id = 0, $subscr_txn_baid_cid_id = '')
{
if($user_id || ($subscr_txn_baid_cid_id && ($user_id = c_ws_plugin__s2member_utils_users::get_user_id_with($subscr_txn_baid_cid_id)))
|| (!$user_id && !$subscr_txn_baid_cid_id && is_object($user = wp_get_current_user()) && !empty($user->ID) && ($user_id = $user->ID))
)
{
$_subscr_baid = get_user_option('s2member_subscr_baid', $user_id);
$_subscr_cid = get_user_option('s2member_subscr_cid', $user_id);
$_subscr_id = get_user_option('s2member_subscr_id', $user_id);
if($_subscr_id)
$ipn_signup_vars = get_user_option('s2member_ipn_signup_vars', $user_id);
if(!is_array($ipn_signup_vars)) {
$ipn_signup_vars = array(
'subscr_cid' => $_subscr_cid,
'subscr_id' => $_subscr_id,
'custom' => $_SERVER["HTTP_HOST"],
'period1' => '',
'period3' => '',
'payer_email' => '',
'first_name' => '',
'last_name' => '',
'option_name1' => '',
'option_selection1' => '',
'option_name2' => '',
'option_selection2' => '',
'item_name' => '',
'item_number' => '',
);
}
return $ipn_signup_vars;
}
return FALSE; // Otherwise, return false.
}
Please let me know if you try it and how it goes.