Recent Topics

1 Oct 06, 2010 17:42    

My b2evolution Version: 2.x

Is there a way to close comments on older posts with b2e? If not, I'd love to see this. Most spammers find older posts (I guess they hope you won't notice) to leave their spam comments.

Many other blog platforms out there have the ability to turn off comments on older posts while leaving current posts available for commenting. Any way to do this?

2 Oct 07, 2010 04:03

I can't speak for v2.x, but on the current versions you can disable it on a post-by-post basis (assuming you setup the blog appropriately).

I don't know of any way to disable it automatically for all posts older than X days, though. Seems like you could write a plugin, though.

3 Oct 07, 2010 15:44

Yes, that's what I'm looking for - something that automatically turns off comments for any/all posts older than X weeks/days/whatever.

I'm aware of the disable on a post-by-post basis, but if I have to do it manually for each post, then I might as well keep doing what I'm doing now - which is deleting all the spam comments. :)

4 Oct 07, 2010 16:57

Could be tricky. It certainly wouldn't be hard but it would require that "Scheduled Jobs" are properly setup on the installation -- something that's not always feasible depending on hosting.

Without a scheduled job, you'd have to rely on checking the "age" of the post each time it was opened for viewing. Not impossible, but certainly not optimal.

The best route would probably be to have any potential plugin close the comments when the last comment was older than a predefined date.

5 Oct 07, 2010 18:36

There is actually a method a plugin can use to say whether comments are allowed (ItemCanComment() I think off the top of my head). Just check the age of the post (or the last comment) here and return true or false.

L

6 Oct 13, 2010 22:49

Thanks for everyone's responses.

It's a shame it can't be done easily. Wordpress has this option, as well as other blogging platforms. With the amount of comment spam I'm getting on old posts (oh, to have that many actual readers! :lol: ) it's a move worth considering, unfortunately.

I've had over 50 spam comments just today on old posts.

7 Oct 14, 2010 00:53

You can do this easily with 1 line of code. Either run this code as a scheduled task (edit the existing one), or put it in your index.php

$DB->query('UPDATE evo_items__item SET post_comment_status = "closed" WHERE NOW() > DATE_ADD(post_datecreated, INTERVAL 30 DAY) ');

Putting this query in index.php will slow the site down a bit, though.

8 Oct 14, 2010 01:28

sam2kb wrote:

You can do this easily with 1 line of code. Either run this code as a scheduled task (edit the existing one), or put it in your index.php

$DB->query('UPDATE evo_items__item SET post_comment_status = "closed" WHERE NOW() > DATE_ADD(post_datecreated, INTERVAL 30 DAY) ');

Putting this query in index.php will slow the site down a bit, though.

Thank you!! I took the easy way out and ran a SQL query in my DB using:

UPDATE evo_items__item SET post_comment_status = "closed" WHERE NOW() > DATE_ADD(post_datecreated, INTERVAL 10 DAY)

With 10 days instead of 30 and it worked perfectly. Thank you! I'll just do this every couple of weeks and it should solve my problem. :)


Form is loading...