Blocking


The Kirby Comments plugin offers hooks for you to alter its behavior. This page demonstrates the decide-block-comment hook, which is called after a comment has been constructed, but before it is saved.

On this page, using the word “WordPress” in the message field is forbidden.

c::set('comments.hooks.decide-block-comment', function ($comments, $comment) {
  if (preg_match('/WordPress/i', $comment->rawMessage()) {
    throw new Exception('You shall not use the word “WordPress”!', 401);
  }
});

Comments

test

wordpres s

Sven

Hallo…

test

hello

Write your comment