latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Fixed EOT with auto generated year?

Home Forums Community Forum Unofficial Extensions/Hacks Fixed EOT with auto generated year?

Tagged: , , ,

This topic contains 2 replies, has 1 voice. Last updated by  Danny Kim 3 years, 6 months ago.

Topic Author Topic
Posted: Thursday Jun 20th, 2013 at 5:17 pm #52303
Danny Kim
Username: dannyk1m

Hey guys.
I’m a newby when it comes to PHP and could use some help..
So I’m setting up a Fixed EOT for July 31st.
Here’s the code I’m using..

[s2Member-Pro-PayPal-Form... tp="" tt="D" ... /]

This works fine the way it is but..
I need the year to auto generate according to the date.
If user registers before July 31, EOT year will stay the same.
If user registers after July 31, EOT year will change to next year.

Your help is greatly appreciated! Thanks!

List Of Topic Replies

Viewing 2 replies - 1 through 2 (of 2 total)
Author Replies
Author Replies
Posted: Friday Jun 21st, 2013 at 5:01 pm #52346
Danny Kim
Username: dannyk1m

would this work…?

<?php
$now = strtotime("now");
$fixed_time = strtotime("31 July " . date("Y"));

if($now > $fixed_time)
$fixed_time = strtotime("+1 year", $fixed_time);

$days_until_fixed_time = round(($fixed_time - $now) / ($seconds_in_one_day = $86400));
?>

[s2member-Pro-PayPal-Form... tp="<?php echo $days_until_fixed_time; ?>" tt="D" ... /]
Posted: Wednesday Jun 26th, 2013 at 1:56 pm #52627
Danny Kim
Username: dannyk1m

figured it out..here’s what works if anyone else is interested in this…
First, you need to install the ‘PHP Execution’ plugin so you can put php code in the page content.
Create a page(or use an existing one), then make sure ‘Text’ is selected, not ‘Visual’, in the editor.
Add code..changing the date to whatever you need..

<?php
$now = strtotime("now");
$fixed_time = strtotime("31 July " . date("Y"));

if($now > $fixed_time)
    $fixed_time = strtotime("+1 year", $fixed_time);

$days_until_fixed_time = round(($fixed_time - $now) / (86400));
?>

[s2member-Pro-PayPal-Form... tp="<?php echo $days_until_fixed_time; ?>" tt="D" ... /]

Be sure to include the full PayPal Pro form.
It was shortened above just to display what is needed to make the code work.

This will set the EOT date to July 31(or whatever date you want to change it to..).
If the user registers BEFORE the EOT date, the current year is used.
If the user registers AFTER the EOT date, the next year is used.

Enjoy.

Viewing 2 replies - 1 through 2 (of 2 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.