You are here

function spam_operations_callback in Spam 6

Same name and namespace in other branches
  1. 5.3 spam.module \spam_operations_callback()

Callback function for admin mass editing spam. Mark as spam.

1 string reference to 'spam_operations_callback'
spam_spam_operations in ./spam.module
Implementation of hook_spam_operations(). Probably doesn't need to be an API hook, because spam functions won't differ much between submodules (ex. mark and unmark) and are already abstracted from the content type. Forms should only…

File

./spam.module, line 1501
Spam module, v3 Copyright(c) 2006-2008 Jeremy Andrews <jeremy@tag1consulting.com>. All rights reserved.

Code

function spam_operations_callback($spam, $op) {
  foreach ($spam as $content) {
    $pieces = explode('-', $content);
    if (drupal_strlen($pieces[0]) && drupal_strlen($pieces[1]) && drupal_strlen($op)) {
      $func = "spam_{$op}";
      if (function_exists($func)) {
        spam_log(SPAM_VERBOSE, 'spam_operations_callback', t('bulk update @op', array(
          '@op' => $op,
        )), $pieces[0], $pieces[1]);
        $func($pieces[0], $pieces[1]);
      }
      else {
        spam_log(SPAM_LOG, 'spam_operations_callback', t('no such function (@func), failed op(@op)', array(
          '@func' => $func,
          '@op' => $op,
        )), $pieces[0], $pieces[1]);
      }
    }
    else {
      spam_log(SPAM_LOG, 'spam_operations_callback', t('unexpected error: content_type(@type) content_id(@id) op(@op)', array(
        '@type' => $pieces[0],
        '@id' => $pieces[1],
        '@op' => $op,
      )));
    }
  }
}