Jump to:

1851 Posts in 1606 Topics by 561 members

Blog Module

SilverStripe Forums » Blog Module » Counting Approved comments

Discuss the Blog Module.

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

Page: 1
Go to End
Author Topic: 978 Views
  • Adam .
    Avatar
    Community Member
    2 Posts

    Counting Approved comments Link to this post

    I'm using the blog module and I need to get a count of all the comments that have been moderated/approved. I'm currently using $Comments.Count but that counts all comments not the just the moderated comments. Does anyone know how i can count just the moderated comments?

  • Adam .
    Avatar
    Community Member
    2 Posts

    Re: Counting Approved comments Link to this post

    SOLVED!

    add this to BlogEntry.php

    public function getApprovedComments(){
       return $this->Comments('Comment.Moderated = 1');
    }

  • RuthAdele
    Avatar
    Community Member
    19 Posts

    Re: Counting Approved comments Link to this post

    I'd like to add for clarity that you now need to call ApprovedComments in your template.

    978 Views
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.