Topic: Locking old threads in the forum (Read 1535 times)
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 5799
46391 credits Members referred : 3
« on: Feb 19, 2009, 08:15:18 am »
As you may know we had some spam problems lately in webdigity. One of the things I had to do was to lock old threads as many of the spammers were posting in threads that were last updated years ago.
So if you want to automatically lock all threads that are for instance 6 months old (in fact this is for threads that their last reply is 6 months old), open phpMyAdmin (or any other query tool you are using) and execute this SQL command:
Code:
UPDATE `topics` INNER JOIN `messages` ON ( `topics`.`ID_LAST_MSG` = `messages`.`ID_MSG` ) SET `topics`.`locked` =1 WHERE `messages`.`posterTime` + ( 6 *31 *24 *60 *60 ) < UNIX_TIMESTAMP( )
If you need to lock threads that are more or less than 6 months old, just change the 6 in the (6*31*24.... statement
Update: If you are using a table prefix just replace `topics` and `messages` with `PREtopics` and `PREmessages` where PRE is your actual prefix
« Last Edit: Feb 19, 2009, 08:59:33 am by Nikolas »