PDA

View Full Version : SQL Query to move banned users?


MagicPID
04-15-2012, 04:34 AM
I need an SQL Query that will move all banned users that were just moved to the usergroup Banned and do not have an actual ban reason.

Is this possible?

Thanks

borbole
04-15-2012, 12:04 PM
I need an SQL Query that will move all banned users that were just moved to the usergroup Banned and do not have an actual ban reason.

Is this possible?

Thanks

Do you want to move all users in the banned group who do not have a banned reason to another group?

Run this query:

UPDATE vb_user
LEFT JOIN vb_userban
ON
(vb_userban.userid = vb_user.userid)
SET vb_user.usergroupid = x WHERE vb_user.usergroupid = 8
AND vb_userban.reason = '';

Replace the x with the id of the group where you would like to move the banned members who do not have a banned reason and replace the vb_ prefix with whatever prefix that you use for your database tables.

Also make a backup of the user and userban tables as well before you run the query.

MagicPID
08-15-2012, 05:04 AM
I just now got around to doing this and that query only does members that were actually banned using the banning system.

My issue is the users were just changed to the banned usergroup.