Not Solved Possible to bulk delete old posts?
#1
Not Solved
I have just installed a new installation of MyBB (1.8.19for a small (100-200 member) professional organization. This will be a private board. 

We are currently taking it for a trial run, but I like everything I see so far.

However, we are interested in current conversation, and are not interested in large archives of previous messages. I have searched and can find no information on a method to batch delete old posts.

Basically, I want to be able to delete all threads or posts that are older than x months (say 6 or 12). Is it possible? If so, how?

Thanks.
Reply
#2
Not Solved
I found this plugin: https://community.mybb.com/mods.php?action=view&pid=136 . It hasn't been updated in a while so no guarantees how well it will work.

If it doesn't work, your next best option is to go to your database and run delete queries on the mybb_posts and mybb_threads tables. There is a column called dateline which is the timestamp of the post. After deleting the threads, you will need to rebuild the statistics cache in the ACP->tools & Maintenance->Cache Manager.
Reply
#3
Not Solved
Thanks for your response. I am reluctant to try a plugin that will attempt to modify the actual database when it is obviously for a previous version and could do a lot of damage, so I'll pass on that one.

I have no problem doing this directly in the database. Good to know it won't do any permanent damage and about the resetting of the stats.

So, as an example, I will have to develop a query to:
a) identify all threads that have not had a new post in 12 months (that could be the tricky one)
b) delete all the posts in those threads
c) delete the threads

What about attachments? Are they linked to the posts, or are they orphaned if the post is deleted?

Roy
Reply
#4
Not Solved
(2019-02-13, 01:54 PM)canadaroy Wrote: Thanks for your response. I am reluctant to try a plugin that will attempt to modify the actual database when it is obviously for a previous version and could do a lot of damage, so I'll pass on that one.

I have no problem doing this directly in the database. Good to know it won't do any permanent damage and about the resetting of the stats.

So, as an example, I will have to develop a query to:
a) identify all threads that have not had a new post in 12 months (that could be the tricky one)
b) delete all the posts in those threads
c) delete the threads

What about attachments? Are they linked to the posts, or are they orphaned if the post is deleted?

Roy
$twelvemonths = 86400*365;
DELETE FROM mybb_threads WHERE lastpost < TIME_NOW - $twelvemonths;
DELETE FROM mybb_posts WHERE dateline < TIME_NOW - $twelvemonths;

Attachments become orphaned, but there is a tool in ACP under Forums & Posts for attachments. You can then see the orphaned attachments and mass delete. I do wish that foreign keys were implemented though because it would be much easier for tasks like this. Hopefully 1.9 will use this; I haven't checked.
Reply
#5
Not Solved
Thanks. I think this is close, but if I executed these the second statement would also delete posts from threads that may be old, but are still active i.e. last post within the last year.

I think I want a list of the tid's from the first statement because that defines my "dead thread" and then delete all posts with that tid.

I would have to look up the syntax of such a combined statement, but that's the idea.

Roy
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)