We migrated to Discourse from another forum software, and I want to close a batch of old topics at once.
Iāve tried using the forum setting for auto-close:
But this seems not to be affecting migrated old topics, as they are still open. How can I achieve this? (want to close all topics which are older than 720 hours=30 days)
Click the āmenuā icon next to the Topic column header, select the topics to close, click the wrench in the upper right, and select āClose Topicsā in the Bulk Actions menu.
cd /var/discourse
./launcher enter app
rails c
Topic.where(closed: false).where("created_at < '2015-01-01'").find_each do |topic|
topic.update_status("closed", true, Discourse.system_user)
end
And you should have all the topics created before January 1st 2015 closed