Page 1 of 1

How are EOT's handled on multiple items per member

PostPosted: May 11th, 2011, 10:22 pm
by dethier
I just thought of this the other day and I'm wondering if you can help me understand how s2member handles EOT in the following scenarios.

First here's my setup:
Level 1 = (no purchase necessary, no EOT)
Level 2 = (purchase 1 year non-recurring subscription)
Level 3 = (purchase 1 year non-recurring subscription)
Level 4 = (purchase 1 time, no EOT)
multiple custom_caps for screening download access, each cap has various purchase prices for 1 year access to the download (non-recurring subscription). These custom_caps are all associated with the Level 1 role.

Scenario Question:
If a customer makes a purchase of one of the custom caps and then at a later date purchases another cap how will the EOT be affected? The way I want it is that the first custom cap purchased will expire 1 year from it's purchase and the second custom cap purchased will expire 1 year from it's purchase. However, it appears that s2Member will always reset the EOT for the subscription length of the latest purchase. Is that what happens?

Another related scenario:
A customer purchases a custom_cap and then at a later date purchases a level 2 subscription. My question is similar to above. How will the EOT be affected?

Thanks for any answer you can give me.

Re: How are EOT's handled on multiple items per member

PostPosted: May 13th, 2011, 4:06 am
by Jason Caldwell
Thanks for your inquiry.
it appears that s2Member will always reset the EOT for the subscription length of the latest purchase. Is that what happens?

Yes, that is correct. We're working to improve this in the next release or two, in order to provide further control over this behavior. Until then, you might try modifying this hack a bit to get what you need.

Create this file and directory:
/wp-content/mu-plugins/s2-hacks.php
Code: Select all
<?php
add_action 
('ws_plugin__s2member_during_paypal_notify_during_before_subscr_signup_w_update_vars', 'during_before_subscr_signup_w_update_vars');
function during_before_subscr_signup_w_update_vars ($vars = array ())
{
    $GLOBALS['existing_s2_eot_time'] = get_user_option ('s2member_auto_eot_time', $vars['user_id']);
}

add_action ('ws_plugin__s2member_during_paypal_notify_during_subscr_signup_w_update_vars', 'during_subscr_signup_w_update_vars');
function during_subscr_signup_w_update_vars ($vars = array ())
{
    if (($eot_time = get_user_option ('s2member_auto_eot_time', $vars['user_id'])) && $GLOBALS['existing_s2_eot_time'])
        update_user_option ($user_id, 's2member_auto_eot_time', $eot_time + ($GLOBALS['existing_s2_eot_time'] - time ()));
}
?>
* This hack is designed to extend the EOT Time instead of having it reset. So not exactly what you need, but perhaps you can tweak this a bit to get what you need until we implement new features that allow this behavioral setting from the UI panel.

Re: How are EOT's handled on multiple items per member

PostPosted: May 13th, 2011, 10:12 am
by dethier
Thanks Jason,
Your answer saved me digging into the code to see how things were done. Thanks VERY MUCH for the code sample as well! It gives me an idea how to setup what I need to do to get what I want to have done.

However, it looks like there is only ONE EOT variable saved with the user data. In other words, whenever a new custom capability subscription is purchased it will just replace the existing EOT with the user (either using the core code or the hack you provided to extend the time). I guess what I'm needing to do, is for custom capabilities I need to add different EOT for the user so the correct expiry date for the custom capability they purchased will be saved (i.e. they expire at different times). Does this make sense? The s2Member levels will of course have the default EOT time updated/extended but the custom capabilities need to have EOT's separate (except in my case for member level 4).

Do you have a rough idea when the modifications will be released (and by rough, I totally understand that it would be a flexible date, I know how development timelines can change)

Re: How are EOT's handled on multiple items per member

PostPosted: May 13th, 2011, 3:55 pm
by Jason Caldwell
You're very welcome.
Well, it *could* be as early as the next release late this month ( although not likely ). If not then, I'd look for it late June ( possibly early July ). We have several things we're working on for June that are going to revolve around the concept of Capabilities/Content Dripping and EOTs.