Page 1 of 1

Test for user with cancelled subscription

PostPosted: May 3rd, 2011, 4:10 am
by sruefer
Hi,

I am creating dynamic menus depending on user subscription level in my template files, and I stumbled over a case which I did not cover yet (and I do not know how to do so for now).

If a user decides to cancel his subscription, or to downgrade it (either way), I would use a cancel or modify subscription button. I understand that afterwards, the user should still be able to access the contents he paid for, despite having cancelled or downgraded his subscription. However, how can such a user be identified?
For example, if a user cancelled his level 1 subscription, then officially he should now be Level 0. But at the same time, he should still be able to see Level 1 content. But a Level 1 user gets different membership upgrade options presented than a Level 0 user (as Level 1 upgrades might involve discounts etc.). So would that user now be tested for by [current_user_is(s2member_level0)]? Or s2member_level1? And if he would fall under s2member_level0, would he still be able to view content that I make only accessible to level1? That could case problems because some pages I allow only to be accessible by level1 users (like the membership cancellation page, or the membership cancellation feedback form page).

Thank you for your help,
Kind regards,
Steffen

Re: Test for user with cancelled subscription

PostPosted: May 3rd, 2011, 12:21 pm
by Cristián Lávaque
Yeah, I see your problem. Have you considered maybe using custom capabilities to identify them and filter the content? Maybe that'll allow you to achieve it.

Re: Test for user with cancelled subscription

PostPosted: May 3rd, 2011, 12:38 pm
by sruefer
That sounds like a good idea, I did not think about that. What worries me a bit is that with any additional capability the number of possible combinations is going up rapidly; I need to check the details to see if it is worth while to implement.
So does that mean that someone who had a subscription of level#1 + ccap=newsletter and decided to downgrade the custom capability or to cancel his subscription entirely is still at level#1 + ccap=newsletter until the payment period expires? And after the expiry he will be level#1, or if cancelled level#0?

Thanks, regards,
Steffen

Re: Test for user with cancelled subscription

PostPosted: May 4th, 2011, 3:22 pm
by Jason Caldwell
When a Member cancels, s2Member will flag their account with an Auto-EOT Time, so that access is denied at the correct point in time; based on whether they were within a free trial period, or not. It also looks to see when their last payment came through, and it makes a decision about the proper EOT Time, based on all of these factors, including the actual length of each payment term associated with their premium access.

To put it simply, a cancellation really just stops billing; and it tells s2Member that access should be denied at some point in the future ( based on several factors ). That's it. That's all a cancellation does. It does NOT terminate their access, not immediately. This is the intended behavior.

Some other details that might help clarify.
There might be times whenever you notice that a Member's Subscription has been cancelled through PayPal®... but, s2Member continues allowing the User access to your site as a paid Member. Please don't be confused by this... in 99.9% of these cases, the reason for this is legitimate. s2Member will only remove the User's Membership privileges when an EOT ( End Of Term ) is processed, a refund occurs, a chargeback occurs, or when a cancellation occurs - which would later result in a delayed Auto-EOT by s2Member. s2Member will not process an EOT until the User has completely used up the time they paid for. In other words, if a User signs up for a monthly Subscription on Jan 1st, and then cancels their Subscription on Jan 15th; technically, they should still be allowed to access the site for another 15 days, and then on Feb 1st, the time they paid for has completely elapsed. At that time, s2Member will remove their Membership privileges; by either demoting them to a Free Subscriber, or deleting their account from the system ( based on your configuration ). s2Member also calculates one extra day ( 24 hours ) into its equation, just to make sure access is not removed sooner than a Customer might expect.

So now, once the time comes, and the aforementioned cancellation results in an actual EOT ( End Of Term ), s2Member will demote the paid Member back down to Level #0, and any Custom Capabilities they had are removed as well. So the paid Member is now a Free Subscriber with no Custom Capabilities. They will continue to have access to the Login Welcome Page, and any content that is available at Level #0, but that's it. At this point, you would use current_user_is(subscriber). Although current_user_is(s2member_level0) works, that's not the recommended way of identifying a Free Subscriber. You should use current_user_is(subscriber) instead. All of these are valid.
Code: Select all
current_user_is(subscriber)
current_user_is(s2member_level1)
current_user_is(s2member_level2)
current_user_is(s2member_level3)
current_user_is(s2member_level4)

Re: Test for user with cancelled subscription

PostPosted: May 4th, 2011, 10:31 pm
by sruefer
Jason,

thanks for your reply. I was not aware of using "subscriber" instead of s2member_level0, thanks for that, I will fix that on my site.
So to summarize, whether it is cancellation or downgrade, a user where the previous billing amount is stopped or modified will still be able to access all he paid for until the expiry date. In general that is a good thing, but it makes it more difficult to target these users for a special campaign (for example, putting extra effort into gaining them back as paying customers, or giving them special permissions etc.).
Regards,
Steffen

Re: Test for user with cancelled subscription

PostPosted: May 4th, 2011, 11:12 pm
by Jason Caldwell
You're very welcome.

I see. Well, one thing that a cancellation does do, is it results in the EOT Time being set. Depending on what else you are selling, you might be able to get away with something like this in your code. I realize it's not ideal, but it might help you some until we come up with a more elegant solution.

Code: Select all
<?php
if(get_user_option("s2member_auto_eot_time")){
    echo "Your paid access will expire soon.";
}
?>

Or, possibly something like this even.
Code: Select all
<?php
if($time = get_user_option("s2member_auto_eot_time")){
    echo "Your paid access will expire on " . date("F j, Y", $time);
}
?>

Re: Test for user with cancelled subscription

PostPosted: May 4th, 2011, 11:17 pm
by sruefer
Sounds like a good idea. I assume t hen that "s2member_auto_eot_time" is empty if no cancellation of a recurring subscription payment occured? Then again, if a user downgraded to a cheaper subscription instead of cancelling, this should also be not populated?

Re: Test for user with cancelled subscription

PostPosted: May 4th, 2011, 11:33 pm
by Jason Caldwell
That's correct.

Except, s2Member will also set an EOT Time when you sell Buy Now access to Membership where there is a fixed term length to the access. In other words, if you sell a Buy Now transaction at $24.95 that grants exactly one year of access, s2Member will know ahead of time the exact date of the EOT, and it will assign the EOT Time immediately after checkout.

As long as you're not selling any Buy Now access to Membership though, you should be fine.

Re: Test for user with cancelled subscription

PostPosted: May 5th, 2011, 12:00 pm
by Cristián Lávaque
I wrote this to help someone display a similar message using EOT

Code: Select all
if ($days = get_user_option('s2member_auto_eot_time'))
{
    $days = ceil(($days - time()) / 86400);

    if ($days < 1)
        echo 'Your subscription has expired.';
    elseif ($days == 1)
        echo 'Your subscription will end tomorrow!';
    else
        echo 
'You have ', $days, ' days left.';
}
 


Or, if you don't have an EOT but you know how long their membership term is, you could use 's2member_last_payment_time' instead of 's2member_auto_eot_time', and change the math to figure out the days left.

Re: Test for user with cancelled subscription

PostPosted: May 6th, 2011, 10:21 am
by sruefer
Ok sounds good. I am not planning to implement Buy Now buttons, so that should be fine.

Cristian, thanks for the code snippet, looks good.

Thanks a lot for your support, much appreciated :)
Steffen