Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » Disable comments

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

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

Page: 1
Go to End
Author Topic: 2818 Views
  • Decisive Flow
    Community Member
    73 Posts

    Disable comments Link to this post

    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: http://www.silverstripe.com/feature-requests/flat/534?showPost=542

  • Sam
    679 Posts

    Re: Disable comments Link to this post

    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 PageCommentInterface.ss in your site's template folder. This will be used instead of the default PageCommentInterface.ss 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 %>


Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.