I want to block comments which include "*http*"
How to block post contain specific keywords or website?
Your filter comment could be something like this:
public function filter_comment(&$comment, &$errors, $question, $parent, $oldcomment) { if (preg_match("/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/",$comment['content'])){ $errors['content'] = 'You can not include url in comments!'; } }
Welcome to the Q&A site for Question2Answer.
If you have a question about Q2A, please ask here, in English.
To report a bug, please create a new issue on Github or ask a question here with the bug tag.
If you just want to try Q2A, please use the demo site.