Jump to content

Developer Documentation

Supporting the report center in comments

How to implement reporting for comments

Firstly, your comment model needs to implement the reporting interface, like so:

implements \IPS\Content\ReportCenter

You will also need to define a new property on your model:

public static $icon = 'string';

This property specifies a FontAwesome icon that will be used to identify this content in the report center. The value should be the name of the icon, without the fa- prefix.

 

Additional model methods available

boolean canReport( [ \IPS\Member $member ] )

Indicates whether the member has permission to report the comment, considering whether their group has permission to report content, whether they can view the content, whether they have already reported the content, and whether they are the original author.

  • $member (\IPS\Member, optional)
    The member whose permissions should be checked. By default, the currently-logged in member will be used.

 

\IPS\core\Reports\Report reportstring $reportContent )

Reports a comment, returning the report object.

  • $reportContent (string, required)
    The text of the report.

 

Changed behavior after implementation

  • A “Report” button will automatically appear next to the comment for members who have permission to report the comment.

  Report Document


×
×
  • Create New...