I want to have it so that when any user signs up to our site they expire on 12-31. If they signup before november then they expire this year. if they signup in November or December they expire on 12/31 of the next year.
example
Sign up on 6/1/2018 membership expires on 12/31/2018
sign up on 10/1/2018 membership expires on 12/13/2018
sign up on 11/30/2018 membership expires on 12/31/2019
This is the code I’ve put together from other questions:
add_action ("ws_plugin__s2member_during_configure_user_registration_front_side", "my_fixed_EOT_time");
function my_fixed_EOT_time ($vars)
{
$actualmonth = date('n');
$actualyear = date('Y');
if ($actualmonth > '10'){
$actualyear = date('Y', strtotime('+1 year'));
}
$expire_on = strtotime($actualyear . '-12-31');
update_user_option ($vars["user_id"], "s2member_auto_eot_time", $expire_on);
}
(this is in my theme’s functions.php)
When I test the code it shows the right dates, but in use it’s not setting EOT when people renew their accounts. Is there something I’ve done wrong? Maybe this hook only fires on new registrations?
This is the shortcode i’m using for the signup button:
[s2Member-PayPal-Button level="2" ccaps="" desc="Active Member / $45 Until October 1st." ps="ocra" lc="" cc="USD" dg="0" ns="1" custom="myurl(redacted)" ta="0" tp="0" tt="Y" ra="45" rp="1" rt="Y" rr="BN" rrt="" rra="1" image="default" output="button" /]