Close threads which don't have replies newer then x days in forums y and z:
Code:
UPDATE thread SET open=0 WHERE lastpost < UNIX_TIMESTAMP(DATE_ADD(NOW(), INTERVAL -2 MONTH)) AND forumid IN (11, 25)
This will close all threads in forums 11 and 25 where the last reply is older then 2 month.
To do this automatically as a cron-job, use a script like this:
PHP Code:
<?php
error_reporting(E_ALL & ~E_NOTICE);
if ($DB_site == NULL)
{
exit;
}
$DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET open=0 WHERE lastpost < UNIX_TIMESTAMP(DATE_ADD(NOW(), INTERVAL -2 MONTH)) AND forumid IN (11,25)");
log_cron_action('Threads expired", $nextitem);
?>
Admin note: SQL highlighting is broken (once again?)