(2014-01-06, 10:38 PM)marcus123 Wrote: I have created a simple plugin to block URLs but for some reason error message doesn't show when posting through quick reply help me to fix this issue?
if(preg_match($regex, $post->data['message'], $match))
{
$post->errors['urlfilter']['error_code'] = "Your post has triggered our moderation system!<br/> Please make sure you are not posting any URL as you YET can't post any!<br/> Also check for any grammar errors!";
}
The post datahandler has already validated your post at newreply_do_newreply_end. You will need to hook @ datahandler_post_validate_post instead and set an error like this:
$this->set_error("Your post has triggered our moderation system!<br/> Please make sure you are not posting any URL as you YET can't post any!<br/> Also check for any grammar errors!");
Or using an error code of your own and add a language variable in newreply.lang.php.
Strip off that $match variable also. You don't need it.
(2014-01-06, 11:56 PM)effone Wrote: @shade:
Can't it be done with this?
if($mybb->input['method'] == "quickreply")
{
// Do something ...
}
Also. But other plugins might use the quick reply system without actually setting the method to quickreply, so you might lose some functionalities. Checking for the ajax token will cover them as it's used also in the core.