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:
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: