You are here

function fail2ban_comment_admin_overview_submit in Fail2ban Firewall Integration 7

Same name and namespace in other branches
  1. 6 fail2ban.module \fail2ban_comment_admin_overview_submit()
  2. 7.2 fail2ban.module \fail2ban_comment_admin_overview_submit()

Form submit handler to mass-report and unpublish or delete comments.

1 string reference to 'fail2ban_comment_admin_overview_submit'
fail2ban_form_comment_admin_overview_alter in ./fail2ban.module
Implements hook_form_FORMID_alter().

File

./fail2ban.module, line 59

Code

function fail2ban_comment_admin_overview_submit($form, &$form_state) {
  if ($form_state['values']['fail2ban'] == 1) {

    // The mollom module prefixes the operation name with its own guff.
    // Cope with it.
    if (strpos($form_state['values']['operation'], '-' > 0)) {
      list($id, $operation) = explode('-', $form_state['values']['operation']);
    }
    else {
      $operation = $form_state['values']['operation'];
    }
    foreach ($form_state['values']['comments'] as $cid => $value) {
      if ($value) {
        if ($comment = comment_load($cid)) {
          if ($operation == 'unpublish' || $operation == 'delete') {
            fail2ban_syslog($comment->hostname);
          }
        }
      }
    }
  }
}