PDA

View Full Version : How to mass delete this users?


Divvy
08-26-2011, 11:22 AM
Hello guys,

I notice that many spammers have the word "Man" in their Biography field.
I did a search and found 7544 users... and I want to delete them all, but the only option that I see, is to delete one by one...
Is there any option to delete all this users with those criteria?

Thank you

kh99
08-26-2011, 01:21 PM
I've tried this for only one test user and it seems to work but you probably want to have a backup of your database first.

There's no function to mass delete users by a profile field, but you can prune users by usergroup. So you could do this:

- Create a temporary user group, note the id number.
- Execute this SQL query:

UPDATE user LEFT JOIN userfield ON (user.userid = userfield.userid)
SET user.usergroupid = X WHERE field1 = 'Man'

but replace X with the id of the temp group you created. (If your db has a table prefix you'll need to modify the query to include it).

- In the adminCP go to Users -> Search for Users and search for users in your temp user group, make sure the list of users looks like the ones you want to delete.
- Go to Users -> Prune/Move Users, select your temporary user group and enter '0' for the 'Has not logged on for x days' field. Press 'Find'
- On the next page select 'delete' and press the 'Go' button.