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

XF 1.5 Fix imported user upgrades

Has anyone written some queries to automatically fix imported user upgrades that aren't removing users from their usergroups? I'm not sure what happened, but for some reason when we moved over from VB4, most of our user upgrades didn't insert rows into the xf_user_group_change table, so when the imported upgrades expire, users are keeping their status.

For example,

select user_id from xf_user u where secondary_group_ids like '%19%' and not exists (select * from xf_user_upgrade_active a where u.user_id=a.user_id and user_upgrade_id=2)
generates around 150 users who no longer have the active user upgrade #2, but are still in that upgrade's usergroup. I'd like a query or 2 to 1) Insert rows into the xf_user_group_change table for those upgrades where it doesn't exist and 2) Remove the secondary usergroup from users who no longer have the active upgrade.

I can probably take care of this myself, but if it's already been done by someone else, that'd sure make it easier...


XenForo developer
Staff member
Were your upgrades before you imported primary or secondary group changes? If they were primary group changes, then that isn't something that could be imported and generally needs to be manually maintained. If they were secondary group changes, the necessary change log records should have been inserted.

I'm not aware of a script to change this for you.
They were secondary group upgrades, but they had been converted (pre-migration) from primary group changes.

I can probably pretty easily write a query to update the xf_user_group_change table with the missing records. Can you tell me what the change_key and group_ids columns should contain? I can dig into the code later today to investigate, but if you know off the top of your head, that would probably help me along my way.
Never mind on that last question. Adminer was displaying those two columns in HEX format, which is why the values made no sense to me. Looks like it will be pretty easy to insert the group change records...