print_input_row("Prune After<dfn>Stetting this to a value > 0 will automatically prune all threads from this forum where the last reply is older then the set amount of days</dfn>", 'forum[pruneafter]', $forum['pruneafter']);
Place the following as prune.php in includes/cron
PHP Code:
<?php
error_reporting(E_ALL & ~E_NOTICE);
if ($DB_site == NULL)
{
exit;
}
require_once('./includes/functions_databuild.php');
$forums = $DB_site->query("SELECT forumid, pruneafter FROM " . TABLE_PREFIX . "forum WHERE pruneafter > 0");
while ($forum = $DB_site->fetch_array($forums)) {
$threads = $DB_site->query("SELECT threadid FROM " . TABLE_PREFIX . "thread WHERE forumid=$forum[forumid] AND lastpost <= " . (TIMENOW - ($forum['pruneafter'] * 86400)));
while ($thread = $DB_site->fetch_array($threads)) {
delete_thread($thread['threadid'], 0);
}
build_forum_counters($forum['forumid']);
}
log_cron_action('Forums pruned', $nextitem);
?>
Go to Forum Manager, Edit the Forums you want to be pruned automatically and set the number of days