# Flag

Users can flag a comment as inappropriate. Note that only logged in users should be able to flag a comment.

# Attributes

idID of the flag.
commentThe Comment this flag was made on.
userThe User for the user who made this flag.

# Flagging a comment

You can flag a comment using a POST request to an action controller, and the following template code. You must supply a commentId and siteId in your form.

<form role="form" method="post" accept-charset="UTF-8">
    <input type="hidden" name="action" value="comments/comments/flag">
    <input type="hidden" name="siteId" value="{{ comment.siteId }}">
    <input type="hidden" name="commentId" value="{{ comment.id }}">
    {{ csrfInput() }}

    <button type="submit">{{ 'Flag' | t('comments') }}</button>

Get started with Comments

Available for Craft 3. Get it from the plugin store.