14, February 2012

Locking old threads in the forum - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web site promotion  >  Promoting & building a forum  >  SMF moding & promoting
Topic: Locking old threads in the forum
« previous next »
Pages: [1] Print
Instabuck - The easy way to sell digital products online

Author Topic: Locking old threads in the forum  (Read 1412 times)
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5779
46271 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 »

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Feb 19, 2009, 08:50:04 am »

sometimes the simplest things are the best! thanks for sharing this code...

EDIT you forget to add the smf table prefix, my structure for example is "smf_topics" (I guess that is the default)

So people should check this...
« Last Edit: Feb 19, 2009, 08:52:21 am by Olaf »


Last blog : A new Wordpress theme for our blog
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5779
46271 credits
Members referred : 3



« Reply #2 on: Feb 19, 2009, 08:51:07 am »

Yeah if you don't stop and think a little you would write a 20 lines php snippet to do the same thing Tongue

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Feb 19, 2009, 08:53:31 am »

yes right, if you like phpmyadmin can do so many things...(check my edit above)


Last blog : A new Wordpress theme for our blog
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5779
46271 credits
Members referred : 3



« Reply #4 on: Feb 19, 2009, 08:59:56 am »

Thanks. Prefix added (almost) Smiley

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #5 on: Feb 19, 2009, 09:47:40 am »

do you run this script every day?


Last blog : A new Wordpress theme for our blog
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=8528
Tags : smf forum mod Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web site promotion  >  Promoting & building a forum  >  SMF moding & promoting
Topic: Locking old threads in the forum
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Feb 14, 2012, 04:59:57 am





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.