Developers

Events

Commentics has an events system so that your added code can be notified when things happen.

This is useful if you have your own caching that needs to be cleared when a page changes.

To listen for an event, create a file called all.php inside the folder below:

/comments/system/events/

Inside the file, add your code which should look like this:

                        <?php
                        /* Event for when a new comment is added */
                        if ($event == 'comment_added') {
                          // add your own code here
                        }
                    

The following variables are also available in the file:

  • $page_id
  • $page_identifier
  • $page_reference
  • $page_url
  • $comment_id

For a full list of events, see below:

comment_added

Event for when a new comment is added

comment_edited

Event for when a comment is edited (by either the admin or a user)

comment_liked

Event for when a comment is liked

comment_disliked

Event for when a comment is disliked

comment_reported

Event for when a comment is reported

comment_flagged

Event for when a comment is flagged

comment_approved

Event for when a comment is approved

comment_unapproved

Event for when a comment is unapproved

comment_deleted

Event for when a comment is deleted (by either the admin or a user)

page_rated

Event for when a page is rated (user has clicked the average rating stars)