You are here

function anonymous_publishing_cl_admin_blocked_submit in Anonymous Publishing 7

Submit for the notify_admin_blocked form.

File

modules/cl/anonymous_publishing_cl.admin.inc, line 429
Menu callbacks for the CL tabs on the module admin page.

Code

function anonymous_publishing_cl_admin_blocked_submit($form, &$form_state) {
  if (!array_key_exists('users', $form_state['values'])) {
    drupal_set_message(t('No users.'), 'error');
    return;
  }
  $count = 0;
  foreach ($form_state['values']['users'] as $auid => $settings) {
    if ($settings['unverify']) {
      $count++;
      db_delete('anonymous_publishing_emails')
        ->condition('auid', $auid)
        ->execute();
    }
    db_update('anonymous_publishing_emails')
      ->fields(array(
      'blocked' => $settings['blocked'],
    ))
      ->condition('auid', $auid)
      ->execute();
  }
  if ($count) {
    drupal_set_message(t('Unverified !count.', array(
      '!count' => format_plural($count, '1 user', '@count users'),
    )));
  }
  else {
    drupal_set_message(t('Blocking status saved.'));
  }
}