I am using the Privatemsg module in Drupal 7. I have a hook in a custom module that is triggered when users write a message that is too short. I set this up using the instructions here.
Basically, it looks like this:
function mymodule_privatemsg_message_validate($message) {
$uid = $vars['message']->author->uid;
//if root or help user, message should always go through regardless of length
if ($uid !== '1') {
if ($uid !== '3') {
if (empty($message->thread_id) && strlen($message->body) < 200 ) {
form_set_error('[body][value]', t('My custom message.'));
}
}
}
}
I recently noticed there are not so many messages being sent on my site. I would like to know if it is because they are being blocked by this hook. How can I track how many times it is triggered (and even better if I can know which logged-in users are getting the error message)?
$vars
, but that variable has not been initialized from the function, nor is a function's parameter.