You are here

function spam_notifications in Spam 6

Implementation of hook_notifications()

File

content/spam_content_notifications.inc, line 11
Include file for integration with the contact form.

Code

function spam_notifications($op, &$event, $arg1 = NULL, $arg2 = NULL) {
  if (!spam_filter_content_type('notifications', 'notifications', array())) {
    return;
  }
  switch ($op) {
    case 'event trigger':

      // Check for spam
      switch ($event->action) {
        case 'update':
        case 'insert':

          // Spam node that should not trigger a notification
          if (isset($event->node->is_spam) && $event->node->is_spam) {
            unset($event->save, $event->queue);
          }
          break;
        case 'comment':

          // Spam comment that should not trigger a notification
          if (isset($event->comment->is_spam) && $event->comment->is_spam) {
            unset($event->save, $event->queue);
          }
          break;
      }
  }
}