Skip to content

Commit

Permalink
Bug fix. Using coupon tracking should occur on payment processing als…
Browse files Browse the repository at this point in the history
…o; occurs via Pro Forms.
  • Loading branch information
jaswsinc committed Feb 3, 2015
1 parent 1069caf commit f7efa17
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion s2member-pro
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,9 @@ public static function cp($vars = array() /* Conditional phase for ``c_ws_plugin
if(!empty($coupon['full_coupon_code']) && c_ws_plugin__s2member_utils_conds::pro_is_installed())
{
$user_coupons = is_array($user_coupons = get_user_option('s2member_coupon_codes', $user_id)) ? $user_coupons : array();
$user_coupons = array_merge($user_coupons, (array)$coupon['full_coupon_code']);
$user_coupons = array_unique(array_merge($user_coupons, (array)$coupon['full_coupon_code']));
update_user_option($user_id, 's2member_coupon_codes', $user_coupons);
$processed_coupons = TRUE; // Flag for routines below.
}
c_ws_plugin__s2member_user_notes::clear_user_note_lines($user_id, '/^Demoted by s2Member\:/');
c_ws_plugin__s2member_user_notes::clear_user_note_lines($user_id, '/^Paid Subscr\. ID @ time of demotion\:/');
Expand Down Expand Up @@ -655,6 +656,13 @@ public static function cp($vars = array() /* Conditional phase for ``c_ws_plugin
$fields = get_user_option('s2member_custom_fields', $user_id); // These will be needed in the routines below.
$user_reg_ip = get_user_option('s2member_registration_ip', $user_id); // Original IP during Registration.

if(empty($processed_coupons) && !empty($coupon['full_coupon_code']) && c_ws_plugin__s2member_utils_conds::pro_is_installed())
{
$user_coupons = is_array($user_coupons = get_user_option('s2member_coupon_codes', $user_id)) ? $user_coupons : array();
$user_coupons = array_unique(array_merge($user_coupons, (array)$coupon['full_coupon_code']));
update_user_option($user_id, 's2member_coupon_codes', $user_coupons);
$processed_coupons = TRUE; // Flag for routines below.
}
if($GLOBALS['WS_PLUGIN__']['s2member']['o']['payment_notification_urls'] && is_array($cv = preg_split('/\|/', $paypal['custom'])))
{
foreach(preg_split('/['."\r\n\t".']+/', $GLOBALS['WS_PLUGIN__']['s2member']['o']['payment_notification_urls']) as $url)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public static function cp($vars = array()) // Conditional phase for ``c_ws_plugi
if(!empty($coupon['full_coupon_code']) && c_ws_plugin__s2member_utils_conds::pro_is_installed())
{
$user_coupons = is_array($user_coupons = get_user_option('s2member_coupon_codes', $user_id)) ? $user_coupons : array();
$user_coupons = array_merge($user_coupons, (array)$coupon['full_coupon_code']);
$user_coupons = array_unique(array_merge($user_coupons, (array)$coupon['full_coupon_code']));
update_user_option($user_id, 's2member_coupon_codes', $user_coupons);
}
$paypal['s2member_log'][] = 's2Member Custom Capabilities updated w/ advanced update routines.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static function cp($vars = array()) // Conditional phase for ``c_ws_plugi
if(!empty($coupon['full_coupon_code']) && c_ws_plugin__s2member_utils_conds::pro_is_installed())
{
$user_coupons = is_array($user_coupons = get_user_option('s2member_coupon_codes', $user_id)) ? $user_coupons : array();
$user_coupons = array_merge($user_coupons, (array)$coupon['full_coupon_code']);
$user_coupons = array_unique(array_merge($user_coupons, (array)$coupon['full_coupon_code']));
update_user_option($user_id, 's2member_coupon_codes', $user_coupons);
}
$paypal['s2member_log'][] = 'Specific Post/Page ~ Sale associated with User ID: '.$user_id.'.';
Expand Down

0 comments on commit f7efa17

Please sign in to comment.