• I use a function in s2-hacks.php (in my mu-plugins folder) to edit the EOT to a fixed date, depending on whether the member pays for 1 year, 2 years, or half a year. This is the function:

    add_action('ws_plugin__s2member_pro_before_sc_paypal_form', 's2_hacks_eot_by_date');
    function s2_hacks_eot_by_date($vars = array())
    {
    
    	if(isset($vars["attr"]["years"]))
    	{
    		$years = $vars["attr"]["years"];
    		global $current_user;
    		$user = new WP_User($current_user->ID);
    		$expire_half = strtotime ("2015-06-30");
    		$expire_one = strtotime ("2016-06-30");
    		$expire_two = strtotime ("2017-06-30");
    		if($years == '2') {update_user_option($user->ID, 's2member_auto_eot_time', $expire_two);}
    		elseif($years == 'half') {update_user_option($user->ID, 's2member_auto_eot_time', $expire_half);}
    		else {update_user_option($user->ID, 's2member_auto_eot_time', $expire_one);}
    		unset($vars["attr"]["years"]);
    	}
    	return;
    }

    Members have been renewing their membership and their EOT times have been getting set at 6-30-2017 regardless of the membership length they select on the renewal page. Last year, this function seemed to work fine.

    Also, I have the SAME code on a development/test site on my local server and the date is getting set consistently to 6-30-2016.

    The renewal page shortcode is as follows:

    [s2If current_user_can(access_s2member_level1)]
    [s2Member-Pro-PayPal-Form modify="1" ps="paypal" lc="" cc="USD" dg="0" ns="1" accept="paypal" accept_via_paypal="paypal" coupon="" accept_coupons="0" default_country_code="" captcha="0"]
    [s2Member-Pro-PayPal-Form level="5" ccaps="" desc="level 5 Membership - $75 USD / 1 Year" custom="mydomain.com|R|06-2016" ta="0" tp="0" tt="D" ra="75" rp="1" rt="Y" rr="0" rrt="" rra="2" years="1"]
    [s2Member-Pro-PayPal-Form level="5" ccaps="" desc="level 5 Membership - 2 Years @ $140" custom="mydomain.com|R|06-2017" ta="140" tp="2" tt="Y" ra="0" rp="1" rt="D" rr="0" rrt="" rra="2" years="2"]
    [s2Member-Pro-PayPal-Form level="6" ccaps="" desc="level 6 Membership - $50 USD / 1 Year" custom="mydomain.com|R|06-2016" ta="0" tp="0" tt="D" ra="50" rp="1" rt="Y" rr="0" rrt="" rra="2" years="1"]
    [s2Member-Pro-PayPal-Form level="6" ccaps="" desc="level 6 Membership - 2 Years @ $90" custom="mydomain.com|R|06-2017" ta="90" tp="2" tt="Y" ra="0" rp="1" rt="D" rr="0" rrt="" rra="2" years="2"]
    [s2Member-Pro-PayPal-Form level="1" ccaps="" desc="level 1 Membership - $50 USD / 1 Year" custom="mydomain.com|R|06-2016" ta="0" tp="0" tt="D" ra="50" rp="1" rt="Y" rr="0" rrt="" rra="2" years="1"]
    [s2Member-Pro-PayPal-Form level="3" ccaps="" desc="level 3 Membership - $50 USD / 1 Year" custom="mydomain.com|R|06-2016" ta="0" tp="0" tt="D" ra="50" rp="1" rt="Y" rr="0" rrt="" rra="2" years="1"]
    [s2Member-Pro-PayPal-Form level="3" ccaps="" desc="level 3 Membership - 2 Years @ $90" custom="mydomain.com|R|06-2017" ta="90" tp="2" tt="Y" ra="0" rp="1" rt="D" rr="0" rrt="" rra="2" years="2"]
    [s2Member-Pro-PayPal-Form level="4" ccaps="" desc="level 4 Membership - $50 USD / 1 Year" custom="mydomain.com|R|06-2016" ta="0" tp="0" tt="D" ra="50" rp="1" rt="Y" rr="0" rrt="" rra="2" years="1"]
    [s2Member-Pro-PayPal-Form level="4" ccaps="" desc="level 4 Membership - 2 Years @ $90" custom="mydomain.com|R|06-2017" ta="90" tp="2" tt="Y" ra="0" rp="1" rt="D" rr="0" rrt="" rra="2" years="2"]
    [/s2Member-Pro-PayPal-Form]
    [/s2If]

    If anyone has any suggestions A.S.A.P. I’d REALLY appreciate it. The site has hundreds of renewals that are taking place this week.

    https://www.ads-software.com/plugins/s2member/

Viewing 1 replies (of 1 total)
  • I’m certainly not an expert on these codes, but you seem to have set quite a few trial periods, using the shortcode tp="2" tt="Y"

    It looks like it’s designed to create a trial period of two years, with a regular period of one day: rp="1" rt="D"

    I don’t think PayPal can handle trial periods of that length, and I doubt you mean to be creating trial periods at all for renewals.

Viewing 1 replies (of 1 total)
  • The topic ‘setting s2member EOT conditionally’ is closed to new replies.