Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Premium Account Not Expiring

oboyledkoboyledk New
edited April 2012 in Vanilla 2.0 - 2.8

@x00 Do the accounts automatically revert to normal members after the premium purchase period has ended? Is there a method we can force trigger this to test if its working on the site? we're having an issue where it dosent seem to end premium membership.

Best Answers

  • x00x00 MVP
    Answer ✓

    Note that the expiry is based on session, so if the person hasn't logged in it won't expire. If you want a different type of cron, that could be possible.

    It should simply remove the premium role from the user, and keep their other roles.

    you can force expire by removing the role but that doesn't really help you test the cron.

    You can force expire by changing PremiumExpire date in Gdn_User table. Change the year to the pass is probably the simplest. Login under that user and go to user/upgrade.

    I just tried it now it worked.

    grep is your friend.

  • x00x00 MVP
    Answer ✓

    Well the default premium role is saved by name not id. You should see it in config.php
    e.g.

    $Configuration['Plugins']['PremiumAccounts']['Role'] = 'Premium';

    you can check to see if you still have a role by that name in dashboard/role. If not you need to re save

    grep is your friend.

Answers

  • x00x00 MVP
    Answer ✓

    Note that the expiry is based on session, so if the person hasn't logged in it won't expire. If you want a different type of cron, that could be possible.

    It should simply remove the premium role from the user, and keep their other roles.

    you can force expire by removing the role but that doesn't really help you test the cron.

    You can force expire by changing PremiumExpire date in Gdn_User table. Change the year to the pass is probably the simplest. Login under that user and go to user/upgrade.

    I just tried it now it worked.

    grep is your friend.

  • The role that expires is the premium role that that was active when they upgraded. if you change the premium role after this, it would attempt to to find the old role link to the transaction and expire this, if it can't find it will attempt to find the current default role and expire this.

    For readability the current default role is saved by its name rather id. I'm still on the fence on this, as other config related to categorises don't, and you wouldn't have to re save the config if you changed the name.

    grep is your friend.

  • Is the exiredate field the only one involved in the cron?
    We tested it just now by making a user premium status (manually, by adding a role to them)
    Then went in and set an expiration date of yesterday.

    I logged in with that user, but they retained premium.

  • Just a follow up- is it possible that "Private community" is causing problems again?

  • x00x00 MVP
    edited April 2012

    Role Expiry:

    1. User identified
    2. PremiumExpire in past?
    3. Get user's Roles
    4. Check to see if they have PremiumRole
    5. If not check to see if they have current default Premium role
    6. Remove this role and save remaining roles for user
    7. Add to the log expired for that user
    8. Set user's PremiumExpire to null. (effectively disabling Premium Accounts check)*

    *So adding premium role manually if they don't have a PremiumExpire and PremiumRole, will not expire. Based on the original clients specs, it won't automatically set this up when done manually rather than upgrade, but it will force expire if you save without it.

    The first thing I would check is the Gnd_Category table note down the premium role ID.
    Then see if the PremiumRole matches that ID. They should be assigned that role and they should have the role as PremiumRole and have a valid PremiumExpire in the format YYYY-MM-DD hh:mm:ss (date('Y-m-d H:i:s', $Timestamp); in php). If the have all this try force expiry by changing PremiumExpire.

    grep is your friend.

  • x00x00 MVP
    edited April 2012

    The format above is ISO 8601 to prevent ambiguity when converting.

    the expiry check converts to unix time stamp. strtotime($Expire)<=time()

    grep is your friend.

  • x00x00 MVP
    edited April 2012

    oboyledk said:
    Just a follow up- is it possible that "Private community" is causing problems again?

    I didn't think so, and I tested it with no problem.

    grep is your friend.

  • So a true test would involve "upgrading" an account via the paypal page, then resetting the date value in the DB backwards to see if it takes.

  • yes, But I would first check to see if the premium role still exists, or re-save the setting to make sure.

    grep is your friend.

  • Where would I check on the premium role? I can see that it still exists as it should in the vanilla Dashboard, is there a DB value somewhere?

  • x00x00 MVP
    Answer ✓

    Well the default premium role is saved by name not id. You should see it in config.php
    e.g.

    $Configuration['Plugins']['PremiumAccounts']['Role'] = 'Premium';

    you can check to see if you still have a role by that name in dashboard/role. If not you need to re save

    grep is your friend.

  • Looks good. Not sure what the issue was but its working now. (I did resave)

    Looking back at the premium log I was getting lots of "Premium terminated" instead of PRemium expired's

  • Thanks for the response, you're one of the best Dev's I know for support on your plugins!

  • no worries, in hindsight I think I should save the default role as id. sometime I try too hard to make it understandable, when that should be covered by the interface. I think I will change to $Configuration['Plugins']['PremiumAccounts']['RoleID'] on next release.

    grep is your friend.

  • oboyledk said:
    Looks good. Not sure what the issue was but its working now. (I did resave)

    Looking back at the premium log I was getting lots of "Premium terminated" instead of PRemium expired's

    really? I have two types "expired term" and "force expired"

    grep is your friend.

  • My mistake, I was primarily getting force expired.

    When it worked as expected it would show as expired term. Not sure of the difference between then two.

  • x00x00 MVP
    edited April 2012

    force expired happen when user roles are saved without the premium role.

    As the was no role to expire, then it would make sense as a side effect that you would get force expired in the log, becuase when saved it is not there.

    grep is your friend.

  • I think it is a case of the premium and other roles be changes around, the premium role at the point of transaction was orphaned or removed. That is the role that matters when expiring.

    grep is your friend.

Sign In or Register to comment.