XF 1.1 Delete banned users with under 5 posts

Deleting users with direct queries is not easily done. There are many joins and updates involved. You need to delete the users through the Admin CP, but there is no mass pruning utility so it's one-by-one.
 
I have 2700+ banned users. Is there a fast way to unban users with over 5 posts? Then delete all banned users?

Maybe move all banned users with over 5 posts to a usergroup?
 
There is no mass delete. But banned status is usually sufficient. The software effectively hides banned users for everyone but admins and mods. It's like they don't exist.
 
There is no mass delete. But banned status is usually sufficient. The software effectively hides banned users for everyone but admins and mods. It's like they don't exist.

I'd like to unban everyone but a good chunk of them are bots. How about set usergroup id for banned users with under 5 posts?
 
From that command I put together this. Why would this not work?

UPDATE xf_user
SET user_group_id = 10
WHERE is_banned = 1
AND message_count >= 5;

With a little less reasearch and the functions a bit wrong, why not this?

DELETE xf_user
WHERE is_banned = 1
AND message_count >= 5;
 
The UPDATE is correct.

The DELETE is not something you should run. It will delete the xf_user record, but that is only one of many joined tables. For this reason I do not recommend trying to manually delete users with queries. If you want details then refer to the datawriter:

library/XenForo/DataWriter/User.php

The _getFields() function names the 5 core user tables. The _postDelete() function names many more.
 
Back
Top Bottom