I used this one for my classifieds forum.
public function deleteThreads()
{
$deleteDate = strtotime('-365 days');
$threads = $this->_getDb()->fetchAll("
SELECT * FROM xf_thread
WHERE last_post_date < ?
", $deleteDate);
foreach ($threads AS $thread)
{
$this->getModelFromCache('XenForo_Model_Thread')->deleteThread($thread['thread_id'], 'hard');
XenForo_Helper_Cookie::clearIdFromCookie($thread['thread_id'], 'inlinemod_threads');
}
}
XenForo_Helper_Cookie::clearIdFromCookie($thread['thread_id'], 'inlinemod_threads');
Perhaps. But is there need for such a feature? I probably wouldnt ever use this because I value my topics (except perhaps spam). It'd be more useful to just do a tutorial on how to set this up as a cron job
Code:public function deleteThreads() { $deleteDate = strtotime('-365 days'); $threads = $this->_getDb()->fetchAll(" SELECT * FROM xf_thread WHERE last_post_date < ? ", $deleteDate); foreach ($threads AS $thread) { $this->getModelFromCache('XenForo_Model_Thread')->deleteThread($thread['thread_id'], 'hard'); XenForo_Helper_Cookie::clearIdFromCookie($thread['thread_id'], 'inlinemod_threads'); } }
This function will HARD delete all threads that haven't had a new post in over 365 days. Just add it to a cron.
We use essential cookies to make this site work, and optional cookies to enhance your experience.