1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed No alert should be sent for expired user upgrades if the user upgrade is disabled

Discussion in 'Resolved Bug Reports' started by Chris D, Sep 4, 2014.

  1. Chris D

    Chris D XenForo Developer Staff Member

    The function that downgrades expired user upgrades does not check if those user upgrades are enabled, hence when a user upgrade expires, a user receives an alert to renew a user upgrade that is no longer available to purchase.

    I think the behaviour of downgrading a disabled user upgrade is correct, and there's a check in the code to ensure only existing user upgrades generate an alert, but there is no such check to ensure it can be purchased.

    EDIT: I needed some sort of solution to prevent alerts because I've now migrated every one over to using my Xen Product Manager add-on and I didn't necessarily want to delete the existing data. I added a can_purchase check:

    PHP:
    $upgradeDef = isset($upgradeDefs[$upgrade['user_upgrade_id']]) ? $upgradeDefs[$upgrade['user_upgrade_id']] : null;
    if (
    $upgradeDef && !$upgradeDef['recurring'] && $upgradeDef['can_purchase'])
    {
        
    // only alert if we know about the upgrade and it's not recurring
        // recurring upgrades should get some sort of notice if payment failed
        
    $alertUserIds[] = $upgrade['user_id'];
    }
     
    Last edited: Sep 5, 2014
  2. Mike

    Mike XenForo Developer Staff Member

    Seems reasonable. (y)
     
    Chris D likes this.

Share This Page