MyBB Community Forums

Full Version: Mass Delete
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

How do we go about a mass delete of unapproved Threads & Posts.

There is over 1 million to delete.
If you want to delete all unapproved threads, run this in PHPMyAdmin:
DELETE FROM mybb_threads WHERE visible=0

To delete all unapproved posts, run this query in PHPMyAdmin:
DELETE FROM mybb_posts WHERE visible=0

You'll need to rebuild the stats in the Admin CP after doing this.
(2014-05-29, 12:49 PM)L10Group Wrote: [ -> ]Hi,

How do we go about a mass delete of unapproved Threads & Posts.

There is over 1 million to delete.

Hi There

Note: I am not a database expert. I found how to do certain things by searching the Internet and modifying the code to do what I want.

Please backup your database before using these queries.

I had about 8,000 posts from several spammers.
After a bit of playing the following was found to work well.
Run php my admin in cpanel
Select database and run the following SQL query.

xxxx = user name

DELETE FROM mybb_threads
WHERE username='xxxx ';
DELETE FROM mybb_posts
WHERE username='xxxx ';
DELETE FROM mybb_users
WHERE username='xxxx ';

This will delete the user, all their posts and any threads they have created. It might take a while for a million users and would not be worth doing it this way.

Another suggestion is spammers will have registered recently and most likely have a user id (uid) above a certain number.
If you check the uid fields in user, you can see the spammers user id.

You can run this SQL

xxxx = uid number

DELETE FROM mybb_threads
WHERE uid >='xxxx ';
DELETE FROM mybb_posts
WHERE uid >='xxxx ';
DELETE FROM mybb_users
WHERE uid >=' xxxx ' ;

You should only do this if you have no genuine users above the > number.