Setting s2Member Auto EOT Time In S2 Hacks.php
-
I created a hack to set the s2member_auto_EOT_time to a set date and added it to /wp-content/mu-plugins/s2-hacks.php.
I’ve managed to get it working for renewals, but not for new memberships. I think it may have to do with the user not being created when the script is triggered, but I’m not sure how to work around it.
Here is the code in my s2-hacks.php file:
function s2_hacks_eot_by_date($vars = array())
{if ($vars[“attr”][“years”])
{
$years = $vars[“attr”][“years”];
$user_id = $vars[“user_id”];
//global $current_user;
//$user = new WP_User($current_user->ID);
$expire_half = strtotime (“2014-06-30”);
$expire_one = strtotime (“2015-06-30”);
$expire_two = strtotime (“2016-06-30”);
if($years == ‘2’)
update_user_option($user_id, ‘s2member_auto_eot_time’, $expire_two);
if($years == ‘half’)
update_user_option($user_id, ‘s2member_auto_eot_time’, $expire_half);
if($years == ‘1’)
update_user_option($user_id, ‘s2member_auto_eot_time’, $expire_one);
//unset($vars[“attr”][“years”]);
}
return;
}I’ve tried hooking it into all of the following without success (again, in my s2-hacks.php file):
add_action(“ws_plugin__s2member_during_configure_user_registration_front_side”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_during_paypal_notify_during_subscr_signup_w_update_vars”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_during_paypal_notify_during_subscr_modify”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_during_paypal_notify_after_subscr_signup”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_during_paypal_notify_after_subscr_eot”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_pro_before_sc_paypal_form”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_pro_during_sc_paypal_form”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_pro_during_sc_paypal_registration_form”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_during_configure_user_registration_front_side”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_during_paypal_notify_during_subscr_signup_w_update_vars”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_during_paypal_notify_during_subscr_modify”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_pro_before_sc_paypal_form_after_shortcode_atts”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_preserve_paid_registration_times”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_pro_during_sc_paypal_sp_form”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_during_paypal_notify_during_before_subscr_modify”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_during_paypal_notify_before_subscr_signup_w_update_vars”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_during_paypal_notify_during_before_subscr_modify”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_during_paypal_notify_before_subscr_signup_w_update_vars”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_during_paypal_notify_during_subscr_eot”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_during_paypal_notify_during_express_checkout”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_during_paypal_notify_during_cart”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_during_paypal_notify_after_subscr_eot”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_during_paypal_notify_after_sp_access”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_during_paypal_notify_after_recurring_payment_profile_created”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_during_paypal_notify_after_cart”, “s2_hacks_eot_by_date”);
add_action(“ws_plugin__s2member_during_paypal_notify_before_subscr_eot”, “s2_hacks_eot_by_date”);Finally, here is and excerpt of the shortcode for my paypal form:
[s2Member-Pro-PayPal-Form 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=”1″ ccaps=”” desc=”Student Membership – $50 USD / 1 Year” custom=”testsite.com|06-2015″ ta=”0″ tp=”0″ tt=”D” ra=”50″ rp=”1″ rt=”Y” rr=”0″ rrt=”” rra=”2″ years=”1″]
[s2Member-Pro-PayPal-Form level=”1″ ccaps=”” desc=”Student Membership – 2 Years @ $90″ custom=”testsite.com|06-2016″ 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=”Student Membership – Prorated @ $35″ custom=”testsite.com|06-2014″ ta=”35″ tp=”6″ tt=”M” ra=”0″ rp=”1″ rt=”D” rr=”0″ rrt=”” rra=”2″ years=”half”]
[/s2Member-Pro-PayPal-Form]I submitted a support ticket to s2Member and was advised to ask for advice in this forum instead. Any suggestions are appreciated.
- The topic ‘Setting s2Member Auto EOT Time In S2 Hacks.php’ is closed to new replies.