Weird EOT's while renew account

Hello,

We have updated s2member plugin. While our member renew an account using paypal, EOT date is 22 mar 2264.

FYI.,
We have set fixed EOT for 12/31/2019

Code:
$now = strtotime(‘now’); // The time now (in seconds).
$fixed_eot_time = strtotime('31 December '.date(‘Y’)); // Future time (in seconds).
$days_until_fixed_eot_time = round(($fixed_eot_time - $now) / DAY_IN_SECONDS);

		echo do_shortcode('[s2Member-Pro-PayPal-Form modify="1" level="1" ccaps="" desc="$10 USD / One Time (for 1 year access, non-recurring)" ps="paypal" lc="" cc="USD" dg="0" ns="1" custom="www.domainname.org" ta="0" tp="0" tt="D" ra="10" rp="'.$days_until_fixed_eot_time.'" rt="D" rr="0" rrt="" rra="2" accept="paypal" accept_via_paypal="paypal" coupon="" accept_coupons="0" default_country_code="" captcha="0" success="/thank-you/" /]');

Yeah, it’s weird.

You’re using the $days_until_fixed_eot_time in the rp attribute inttead of the tp one. WP Admin > s2Member > PayPal Buttons > Shortcode Attributes Explained

This proration example I wrote may help you with what you want: Fixed-Term Extensions (Auto-Extend), need improvement

I hope that helps. :slight_smile:

HI thank you for replay.

tp attribute is for trial period. in our case, there are not any trial period.

when our member renew their account, in few cases EOT is weird like 22 mar 2264 instead of 12/31/2019.

Yeah, trial or initial. It doesn’t have to be free. From the first lines of your code it looks like you’re doing proration, so you come up with a period of time, but this would only be for the first term, right? If you put it in the regular term, then all terms will be that long, not just the first.

Oh… I see, you’re not selling a subscription, just whatever is left of the year until Dec 31st, with no recurring payments. I’m sorry, my bad.

I honestly don’t know why that’d be happening. I’d suggest that you test echoing the values of your variables to see them on the page while testing, see if you notice something odd there.

And I’d enable logging, so next time a customer gets a crazy EOT time, you can look up the relevant log entries to see if you notice a clue there. WP Admin > s2Member > Log Files

Shall we add a code to update EOT after paypal payment successfully.? If yes, please write a code and when we add this code.

FYI.,
Our EOT is fix 12/31/2019

Customizations are up to you. What I can confirm is that nobody else has reported yet that they’d get such a weird EOT time.

Since you’re doing some calculations that set the EOT dynamically, I’s suspect that first and debug it. And if that’s not it, then I’d try getting more data from the transactions that have this behavior, that’s why I suggested enable logging.

:slight_smile: