Here's a quickie. Automatically disable comments on posts older than a given timeframe. I find that comments on posts older than a few months are generally spam.
Plug this into your site's custom module. As usual, I am using the convention of 'mymodule' for the namespace, and you'll want to replace this with the name of your actual module.
<?php
function mymodule_cron() {
$time_ago = strtotime("-4 month");
$result = db_query("UPDATE {node} SET comment=1 WHERE created < %d AND type='story' AND comment=2", $time_ago);
}
?>Exercises for the reader: you could also make a settings page to make the "time ago" configurable (currently I have mine hard-coded to 4 months) and the node types to which it applies configurable (currently I have mine hard-coded to 'story' nodes). Also, this probably doesn't need to run every cron run, so it wouldn't hurt to make that configurable too.






There's also the Comment Closer module which has the features you describe. Hope that doesn't constitute cheating on the reader exercise!
Thought I'd give the comment closer a go but its locking topics in my forum even though I have "forum" unselected in my comment closer settings. Anyone else get this?
That's perfect - thanks for the head's up Richard. I'd done a quick search but hadn't come up with anything. Contrib is becoming unwieldy!
I am, in some point, still getting comments from entries posted a few months back. This could be helpful. Thank you for this contribution.
Thanks for the information, the information is really nice and easy to work with, then nice article.
that's perfect, the information you give on the post it is very useful for me, and i'm sure for many people too. keep working like this, i love your work on this blog!
This seems to be a good idea rather than getting huge number of comments for older posts... :)
Angeline @ marcus evans scam
My problem just solved after 1 hour of searching for solution. The re-adjustable codes are easy to work with and understandable. Good programming skills, Bravo.
This is such an informative and useful post for drupal users. Keep updating and thanks for the heads up.
Awesome!
Yeah you're probably right that older comments are hard to find and may need to be digged a lot before one can reach it, so they're prone to more spam than legitimate comments. I've also seen such plugins on WordPress blogs although very few ones feature this on it and it's nice to see it on drupal too. And also install a good spam-filter and CAPTCHA system.
Regards
Ryan Mathys (Pacific Beach real estate)
Agreed. Very insightful post. It saves me having to find out the hard way!
search for magician sites
I consider myself to be a promoted internet user and can say that your resurce is one of not many I like to come back again and again. I just hope that someone finds my search engine on rapidshare files that useful too
Nifty! and very simple too. Thanks for sharing.
So cool and simple, gonna give it a try! Thanks!
Thank you! Ive been looking for this solution for weeks now and havent been able to find it. Its too difficult to keep track of comments on old posts, so much easier to just turn them off.
Now that's a really neat idea. I know this is a stupid question but is there a similar script for wordpress? Thanks
I think you can use Extended Comment Options plugin of Wordpress. But I also like to see comments even on my older posts.
Get a free quote from us for Fitouts
Thanks for the helpful information
I like that in Drupal, for example, the user can create their own weblogs and exchange ideas in forums.
what would drupal do...never heard, but i like that! drupal is a pretty good system, ay. just kind of sad, its not used that often..
Thanks for the helpful information
nice post
thanx alot
Latest Masala | health & fitness | Career options | Bollywood Actress
very useful, does get annoyin whe older blogs just collect pages and pages of comments
i thought that this information was useful, but maybe its just me, but i have a hard time trying to understand, nevertheless, i thank you for the information...boot camp vancouver
I think that this is a great idea, i always have problems on my site and i think that this really helps because this gives me more control over my content.
Excellent article, thanks for sharing the information.
very useful!
I found this module very useful and very easy to install. I checked out the comment closer to recommended by Richard, I dont have a forum on my site so I haven't ran into any problems at all using them.
Thanks for this :)
This module is indeed helpful and user-friendly! I hope to have the same software available.
Thanks for the helpful information
That's nice it would be helpful to everyone.Thanks for your contribution
No more post?
good article... Thanks, :)
I found this module very easy to install, thanks for sharing!
That's a good coding,but please reply about my query.If I want to make changes of time period for weeks or days instead of months,then can I replace "$time_ago = strtotime("-4 month");" by "$time_ago = strtotime("-2 weeks");".Thanks in advance.
Macken,
stair climbing hand trucks
A very useful information for keeping the blog pages up to date.
I wish a Happy New Year 2010
I found your site through the bookmarklet article (which is filled with spam in the comment section). With regard to that I want to mention a trick to discourage spammers and robots even further:
I create a copy of an inputformat with the same configuration as my default input format, but instead at the html-configuration under filter configuration for the new input format i activate the spam deterrent which adds nofollow tags to links. I use the better formats module to add this new input format to my comments only for the relevant content types. This way links will not activate counters. Doing this may hurt your own rankings though, if you depend on comment links for your own ranking so check your analyzers.
Cheers, Willem