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

XF 1.3 Expired user upgrades - Users not removed from group

Discussion in 'Troubleshooting and Problems' started by SchmitzIT, May 27, 2014.

  1. SchmitzIT

    SchmitzIT Well-Known Member


    We seem to be having an issue at one of my customers. I ran the "Downgrade Expired User Upgrade" cron job manually, but that did not seem to remove the users from the group they get added to when they purchase the user upgrade.

    The forum recently was converted from vB 3.6, not sure if that might have anything to do with it?

    I checked the code, and ended up seeing /xenforo/model/userupgrade.php, method downgradeUserUpgrades. I verified the user-id of the user we're using as an example was added to the table 'xf_user_upgrade_expired'.

    Any ideas of where I could start looking why the group membership is not handled?


  2. Mike

    Mike XenForo Developer Staff Member

    Was the upgrade from before XenForo? If it was an upgrade that added a group, then should have logged the groups as temporarily applied. If the upgrade did anything else (changed primary group or something else), we can't import that as we don't have that concept, so things won't change on expiration.
  3. SchmitzIT

    SchmitzIT Well-Known Member

    The upgrade was from before the import. When I check the user, the primary group they are in is Registered (which is what I'd expect), and the group the upgrade places them in is a secondary group.
  4. Jim Boy

    Jim Boy Well-Known Member

    I had a similar issue, eventually worked out there must have been a bug in the migration script from vb as it didn't create records in the xf_user_group_change. Without this record, the automatic downgrade wont work.To fix this issue, it was a case of either manually remove each user's unwanted secondary group or run a script to fix the issue. I went the latter option due to the hundreds or users involved and it worked a charm.

    To see how many users you have who should be downgraded, you can run the following replacing the values in brackets, (you may have to be more stringent than I was with secondary group id, depending on whether you you risk identifying similar user group ids. - eg 28 could be 28 or 128):

    select user_id from xf_user u where secondary_group_ids like '%[secondary group id]%' and not exists (select * from xf_user_upgrade_active a where u.user_id=a.user_id and user_upgrade_id=[upgrade id])

    To see what users might be affected in the future, run the following:

    select user_id from xf_user_upgrade_active u where user_upgrade_id=[upgrade id] and not exists (select * from xf_user_group_change a where u.user_id=a.user_id and group_ids=[secondary group id])
    NixFifty, Tim Jay and SchmitzIT like this.
  5. Tim Jay

    Tim Jay Active Member

    I am having this issue on 1.3 & 1.4. Upgrades expire but users are not always removed from the secondary usergroup. Like 1 out of every 5 remain in the upgraded usergroup without an active upgrade. I am probably missing something here but I don't know what.

    I will give your script a try @Jim Boy
  6. Littlebigdunc

    Littlebigdunc Member

    I have recently changed from vb 4 to xenforo and I'm having the same issue I have almost 600 users that are on a current upgrade I'm having to every day check each upgrade setting for expired uses as they are not downgrading, looking above how do I enter the code?

Share This Page