Notifications
Clear all

wpForo 1.x.x Cleaning up old posts & topics

5 Posts
2 Users
0 Likes
487 Views
erkkiat
Posts: 3
Topic starter
(@erkkiat)
New Member
Joined: 9 months ago

Hi all,

What a great forum software and so easy to install and use. I love it.

I was wondering if there is a way to purge older posts and topics, like over 2 years old etc. I'm worried about my storage plan and would like to make sure I will have a way to trim the database size when needed.

Thanks for any ideas!

-- Eki 

 

wpForo Version
1.9.9.1
WordPress Version
5.9.2
4 Replies
erkkiat
Posts: 3
Topic starter
(@erkkiat)
New Member
Joined: 9 months ago

I should explain the background a bit. The forum centers around mental health, and users are discussing the feelings of the day, medication etc. The relevance of some of the topics decreases over time. The most valuable content is kept, but a periodical cleanup would be useful for cost optimization.

 

Reply
3 Replies
Chris
Admin
(@chris)
Joined: 1 year ago

Support Team
Posts: 2385

Hi @erkkiat,

You can delete posts and topics by newest/oldest date from Dashboard > Forums > Moderation > Published, use the Created Column to sort them by created date.

Second way is that we can give you an SQL which you can use to remove the topics and post lets say which are older 1 year, but for the SQL we need more Rules to make it work correctly:

How old must be the topics/post.

Which topics must not be deleted. For example, those which are sticky or solved or private.

Reply
erkkiat
(@erkkiat)
Joined: 9 months ago

New Member
Posts: 3

Hi @chris,

Excellent! I could store the SQL somewhere for future use. Let's say we want to keep the sticky and private ones written by user "abc". I can modify it accordingly, but it's good to see if there are references I need to consider.

-- Eki 

Reply
Chris
Admin
(@chris)
Joined: 1 year ago

Support Team
Posts: 2385

@erkkiat,

This SQL deletes all Topics, posts, and post fields, which are older than xx date, and it excludes those which are sticky or private created by user 666(user id), those which are not private or sticky created by user 666 will be also deleted.

DELETE t, p, pm FROM `wp_wpforo_topics` t
	LEFT JOIN `wp_wpforo_posts` p ON p.`topicid` = t.`topicid`
	LEFT JOIN `wp_wpforo_postmeta` pm ON pm.`postid` = p.`postid`
	WHERE t.`created` < '2020-01-01 00:00:00'
	AND NOT ( t.`userid` = 666 AND (t.`private` = 1 OR t.`type` = 1 ) )
Reply