MyBB Community Forums

Full Version: How to remove all posts / threads from specific user in specific forum(s)?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
As title says, I want to do it via the MySQL, because manually, it would take a lot of time scrolling through pages etc (there are like 10k posts)

Thanks in advance.
Try these queries.

DELETE mybb_posts FROM mybb_posts JOIN mybb_threads ON mybb_threads.tid = mybb_posts.tid WHERE (mybb_posts.uid = X OR mybb_threads.uid = X) AND mybb_threads.fid IN(1,2,3);
DELETE FROM mybb_threads WHERE uid = X;

The first one will delete all posts by that user, and all posts by any other user in any threads the user created, in the specified forums. The second one will delete any threads the user created in the specified forums.

Change X to the ID of the user, and the 1,2,3 to the IDs of the forums you want this to affect.

Then, run the recount and rebuild tools in the Admin CP.

However, if you're dealing with that many posts, I highly recommend you install a test forum, backup your forum's database, and import it to the test forum's database, and run this on there first, just to check it works. At the very least, close your forum and backup your database before doing it.