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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Blog Module /

Discuss the Blog Module.

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

Counting Approved comments


Go to End


3 Posts   2791 Views

Avatar
Adam .

Community Member, 2 Posts

27 March 2013 at 3:12am

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?

Avatar
Adam .

Community Member, 2 Posts

28 March 2013 at 12:32am

SOLVED!

add this to BlogEntry.php

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

Avatar
RuthAdele

Community Member, 21 Posts

27 June 2013 at 2:38pm

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