Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Comment Spam


Reply


3 Posts   1194 Views

Avatar
grumpypanda

Community Member, 32 Posts

23 June 2011 at 12:36pm

Edited: 24/06/2011 9:15am

Hi everyone,

My client has got a news page, and it allows people to leave comments, unfortunately they've got loads of spam emails. I'm new to this, is there any way we can disable the comment field by default? How do I do it?

Thanks heaps.
Sam

Update - Because this is someone else's code, I just realised that they have some sort of spam protection already, so we are trying to disable the comment option. I have managed to set no comment by default by changing file BlogEntry.php

static $defaults = array(
"ProvideComments" => true,
'ShowInMenus' => false
);

to

static $defaults = array(
"ProvideComments" => false, //changed
'ShowInMenus' => false
);

Am I on the right track to disable comments by default? Also how can I stop on the news page showing the link of 0, or 5 or xxx comments? eg

Test

Posted by Admin on 21 June 2011 | 3 Comments

Tags: P

This is a test....

3 comments | Read the full post

Thanks. S:)

Update - If anyone is interested, I have been changing BlogSummary.ss since yesterday, but nothing changed on the news page. i have just found an old post, "because I was rebuilding the database by going to dev/build, but it was only rebuilding the main site, not the blog. when I added ?flush=1 to the blog url, it rebuilt and showed all my changes."

Thanks everyone. :)

Avatar
Bruce B

Community Member, 145 Posts

23 June 2011 at 4:45pm

To hide existing comments after comments have been disabled, open the _config.php file in mysite folder and add the following lines:

//don't show existing comments if comments are disabled
PageCommentInterface::$show_comments_when_disabled = false;

Avatar
grumpypanda

Community Member, 32 Posts

23 June 2011 at 4:56pm

Edited: 23/06/2011 5:09pm

Hi Bruce B,

Thanks for your reply, I paste the code in my _config.php, it did make the comment content disappear on each news, thank you. However on my news page there are still a couple of comment links on it. Please see example below. How do I delete those 3 Comments links on my news page (on Silverstripe it is Blog Holder as a page type)?

Test

Posted by Admin on 21 June 2011 | 3 Comments

Tags: p
This is a test.

3 comments | Read the full post