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.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Disable comments

Go to End

2 Posts   3182 Views

Decisive Flow

Community Member, 73 Posts

23 March 2007 at 9:26am

Edited: 23/03/2007 9:27am

on blog posts that are getting spammed to death, we want to be able tot turn comments off. I clicked the 'allow comments' in the backend but this stopped any comments from being seen, while still showing the number int he header (i.e you have 20 comments'). You want to have any previous comments still showing just have a little message saying 'you can no longer comment on this post'

And if anyone has any help for getting akismet working, this may solve the problem altogether! ;) - see forum post:


Administrator, 685 Posts

23 March 2007 at 4:23pm

Here's how to change the commenting behaviour on your site:

1) Make a method on Page_Controller called PageComments(). This will override the default behaviour, and show "the comment system even when you've unchecked the show comments box"

* Returns a page comment system
function PageComments() {
return new PageCommentInterface($this, 'PageComments', $this->data());

2) Make a file called in your site's template folder. This will be used instead of the default file. We will change the template so that it shows and hides stuff according to the rules you've described.

<div id="PageComments_holder" class="typography">
<% if ProvideComments %>
<h4>Post your comment</h4>
<% end_if %>

<% if Comments %>

<div id="CommentHolder">
<ul id="PageComments">
<% control Comments %>
<li class="$EvenOdd<% if FirstLast %> $FirstLast <% end_if %> $SpamClass">
<% include PageCommentInterface_singlecomment %>
<% end_control %>
<% end_if %>