However, I'm not sure what value to return from this function to stop a message from being posted if it contains too many videos, I've tried various combinations overriding the $event array but nothing seems to work (my event handler is called correctly but I can't find a way to stop the message from being posted if $max_youtubes is exceeded). I'm now wondering if I am handling the correct event, or if I need to do something different to accomplish this?
Code: Select all
/**
* Check message doesn't include too many youtube videos
*/
public function message_parser_check_message($event)
{
$max_youtubes = $this->config['max_' . $event['mode'] . '_youtubes'];
$num_matches = substr_count($event['message'], "[youtube]");
if ($num_matches !== false && $num_matches > $max_youtubes)
{
$event['warn_msg'][] = sprintf($this->user->lang['TOO_MANY_YOUTUBES'], $max_youtubes);
$event['return'] = true;
return;
}
}
Any help appreciated. TIA.