View Single Post
Old 04 Feb 2011, 13:33
kh99 kh99 is offline
Join Date: Aug 2009
Real name: Kevin
I'm not an expert on doing things through the ACP so there could be a way that I don't know about. But looking at the code, it looks like to add someone to a secondary group you'd just have to add the new groupid to the membergroupid field for that user in the 'user' database table. (membergroupid is a text field that's a comma-separated list of secondary groups).

So what you could do is add everyone who's in one secondary group to another secondary group by doing a mysql query like this:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

where 9 is the group you want to inactivate and 10 is the group you want to merge in to. (Also, if you have a database prefix defined you'd need to add that before 'user' on the first line).

Then when that's done you can just delete the old group in the ACP.

I've tried this on a test site, but of course it might be a good idea to have a database backup before doing this, just in case. Also if you wanted you could try it first with one or a few users by adding " AND userid IN(1, 2, 3)" to the end of the query (putting the userids you want in place of 1,2,3 of course ).

...and of course you can't delete the old group before you've run the query for all users.

ETA: I added "AND NOT FIND_IN_SET(10, membergroupids)" to the above code to avoid listing the same group twice in case a user is already in the second group. But if you've already done it I'm pretty sure it's OK because when it checks if a user is in a group it doesn't matter if it's there twice, and when it removes the user from a group it seems to handle the possibility of it being listed more than once.

Last edited by kh99; 04 Feb 2011 at 16:25.
Reply With Quote