PDA

View Full Version : Lock Old Threads


Gardener
11-09-2002, 07:39 PM
Is the any way to automatically lock old threads after a certain. For example, one of the forums on my board imports several news groups. I would like to be able to automatically loke these after the post is 30 days old.

Logician
11-09-2002, 08:55 PM
edit newthread.php, find:


eval("standardredirect(\"".gettemplate("redirect_postthanks")."\",\"$goto\");");


before that add:


$log_lockdate=mktime (date("H"), date("i"), date("s"), date("m"), date("d")-30, date("Y"));

$DB_site->query("UPDATE thread SET open=0 WHERE dateline<=$log_lockdate AND forumid=X");


Replace X with your forumid you want the auto-lock..

Not tested, first try in a test board! It has SQL query that wil make modifications in the records of your db, so do not apply to your real board without testing it in a test board..

The auto-lock will be triggered whenever someone creates a new thread in your board so do not expect the hack to work if someone does not create a new thread for a few days..

Enjoy

Gardener
11-09-2002, 09:18 PM
Thanks for the help. I'll try it out later tonight.

The auto-lock will be triggered whenever someone creates a new thread in your board so do not expect the hack to work if someone does not create a new thread for a few days..


Since the news groups are pulled every 15 minutes this shouldn't be a problem.

I'll let you know how it works.

Logician
11-09-2002, 09:28 PM
Since the news groups are pulled every 15 minutes this shouldn't be a problem.

nope.. The hack is triggerred when someone creates a thread by going the normal way (via newthread.php). So your other hack's threads will not trigger the hack..

But this still shouldnt be a problem since even the slowest forums have at least 1 thread per day..

mzlogical
11-28-2003, 10:06 AM
how can you add multiple forums?

Logician
11-28-2003, 10:18 AM
change line

$DB_site->query("UPDATE thread SET open=0 WHERE dateline<=$log_lockdate AND forumid=X");


as

$DB_site->query("UPDATE thread SET open=0 WHERE dateline<=$log_lockdate AND (forumid=X OR forumid=Y OR forumid=Z)");

mzlogical
11-28-2003, 11:55 AM
Thanks a lot. :D

Joe
05-15-2004, 02:49 PM
edit newthread.php, find:


eval("standardredirect(\"".gettemplate("redirect_postthanks")."\",\"$goto\");");


before that add:


$log_lockdate=mktime (date("H"), date("i"), date("s"), date("m"), date("d")-30, date("Y"));

$DB_site->query("UPDATE thread SET open=0 WHERE dateline<=$log_lockdate AND forumid=X");


Replace X with your forumid you want the auto-lock..

Not tested, first try in a test board! It has SQL query that wil make modifications in the records of your db, so do not apply to your real board without testing it in a test board..

The auto-lock will be triggered whenever someone creates a new thread in your board so do not expect the hack to work if someone does not create a new thread for a few days..

Enjoy

Any reason this would NOT work in v3.0.0?