SpecialK
Well-known member
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,
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...
For example,
Code:
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)
I can probably take care of this myself, but if it's already been done by someone else, that'd sure make it easier...