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.

EOT fixed date tweak request

Home Forums Community Forum EOT fixed date tweak request

This topic contains 7 replies, has 3 voices. Last updated by  Cristián Lávaque 4 years ago.

Topic Author Topic
Posted: Monday Dec 17th, 2012 at 6:15 am #34826
Ayurveda
Username: panchakarma

Hi Guys,
I’ve installed the code from this thread:

http://www.primothemes.com/forums/viewtopic.php?f=4&t=10100&p=58978#p21726

Can the code could be adjusted so that it always introduces the EOT year as the subsequent year to the year of payment, i.e. if the registration or renewal is carried out in 2012 then the eot is auto generated as 2012+1=2013 ?
This would mean that the .php would not have to be adjusted year on year.

For clarity, the code is:

<?php
add_action ("ws_plugin__s2member_during_configure_user_registration_front_side", "my_fixed_EOT_time");
add_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_signup_w_update_vars", "my_fixed_EOT_time");
add_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_modify", "my_fixed_EOT_time");
function my_fixed_EOT_time ($vars)
    {
        $expire_on = strtotime ("2014-01-01");
        update_user_option ($vars["user_id"], "s2member_auto_eot_time", $expire_on);
    }
?>

And I’m wondering if in the line:

$expire_on = strtotime ("2014-01-01");

, the year value could be auto generated in this way. The reason it is currently set to 2014 is because the site will be going live at 0000hrs on 2013-01-01. All memberships on this site are due for renewal on the first of Jan each year.

It would be GREAT if you guys could help me with this.
Many thanks.

List Of Topic Replies

Viewing 7 replies - 1 through 7 (of 7 total)
Author Replies
Author Replies
Posted: Monday Dec 17th, 2012 at 6:47 am #34827
Ayurveda
Username: panchakarma

Also guys,
I assumed the code would just drop in and work but it breaks the back end of the s2member interface as soon as I add it in?
Any ideas?

Posted: Monday Dec 17th, 2012 at 7:21 am #34830
Ayurveda
Username: panchakarma

OK, for anyone finding this thread who may encounter the same problem, when I cut and pasted the php code, my code editor auto added spaces before and after the opening and closing php tags. With the spaces removed, the S2 back end re-appears as before.

Posted: Monday Dec 17th, 2012 at 10:43 am #34839
Eduan
Username: Eduan
Moderator

Glad you were able to figure it out! :)
And thanks for the solution. ;)

Posted: Monday Dec 17th, 2012 at 11:16 am #34846
Ayurveda
Username: panchakarma

Yes, that rectified the back end problem but I am still faced with the original thread topic:

Hi Guys,
I’ve installed the code from this thread:

http://www.primothemes.com/forums/viewtopic.php?f=4&t=10100&p=58978#p21726

Can the code could be adjusted so that it always introduces the EOT year as the subsequent year to the year of payment, i.e. if the registration or renewal is carried out in 2012 then the eot is auto generated as 2012+1=2013 ?
This would mean that the .php would not have to be adjusted year on year.

For clarity, the code is:

<?php
add_action ("ws_plugin__s2member_during_configure_user_registration_front_side", "my_fixed_EOT_time");
add_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_signup_w_update_vars", "my_fixed_EOT_time");
add_action ("ws_plugin__s2member_during_paypal_notify_during_subscr_modify", "my_fixed_EOT_time");
function my_fixed_EOT_time ($vars)
    {
        $expire_on = strtotime ("2014-01-01");
        update_user_option ($vars["user_id"], "s2member_auto_eot_time", $expire_on);
    }
?>

And I’m wondering if in the line:

$expire_on = strtotime ("2014-01-01");

, the year value could be auto generated in this way. The reason it is currently set to 2014 is because the site will be going live at 0000hrs on 2013-01-01. All memberships on this site are due for renewal on the first of Jan each year.

It would be GREAT if you guys could help me with this.
Many thanks.

Posted: Tuesday Dec 18th, 2012 at 9:43 am #34929

You can use the date function: [hilite code]date('Y') . '-12-31'[/hilite] or maybe [hilite code](date('Y') + 1) . '01-01'[/hilite] (haven’t tested it). http://php.net/date

Posted: Tuesday Dec 18th, 2012 at 11:57 am #34948
Ayurveda
Username: panchakarma

So would I be correct in assuming the line should read:

$expire_on = strtotime ("date('Y') . '-12-31'")

Thanks Cristian.

Posted: Wednesday Dec 19th, 2012 at 8:34 am #35031

No, try:

[hilite pre_code]
$expire_on = strtotime(date('Y') . '-12-31');
[/hilite]

Thanks Cristian.

No problem. :)

Viewing 7 replies - 1 through 7 (of 7 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.