1

Craft CMS V2.
Comment Plugin: verbb comment

{% set comments = craft.comments.all({
    limit: 10,
    status: 'approved'
}) %}

{% for comment in comments %}
    {{ comment.comment }}
{% endfor %}

This query fetches all approved comments including flagged (Comment marked as inappropriate) comments because flagged comment status is 'approved'.

But I want to hide flagged comments from approved comments.

2

You can use the isFlagged() method to only display non-flagged comments:

{% set comments = craft.comments.all({
    limit: 10,
    status: 'approved'
}) %}

{% for comment in comments if comment.isFlagged() == false %}
    {{ comment.comment }}
{% endfor %}
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.