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

Query to remove everyone from a secondary usergroup?

CyclingTribe

Well-known member
#1
I searched but couldn't find a query to use that would allow me to remove everyone from a secondary usergroup; in my case, group ID: 13

Anyone able to advise on how best to do this as I have 2,000 members that need removing from this group and doing it by hand is just a total no-no ... ;)

Thanks,
Shaun :D
 

Chris D

XenForo developer
Staff member
#3
That is going to be easier.

It's tricky as you have to consider that your secondary_user_groups column for some people may look like:

13

But for some people it may look like:

2, 13, 3, 4

Others it may look like

2, 13

(sometimes on its own, sometimes with others and with a comma and other times with others and without a comma).
 

CyclingTribe

Well-known member
#4
Delete the group and recreate it?
Quick and dirty, but it will also change the group ID and I have lots of things tied to the ID - which is why I was looking for a query.

I'd previously automatically opted everyone into this group but now what to reverse it and opt everyone out and only those who specifically request it, opt them back in.

I suppose I could run a series of replace queries for "13" - ", 13," - "13, " - ", 13" - that should cover it shouldn't it?
 

CyclingTribe

Well-known member
#6
Okay, thanks guys - I can't really write a script so I'll do it manually. <Nips off to suggest bulk removal from secondary groups!> (y)

Cheers,
Shaun :D