You are here

function anonymous_publishing_cl_admin_privacy_submit in Anonymous Publishing 7

Submit for the anonymous_publishing_admin_privacy form.

File

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

Code

function anonymous_publishing_cl_admin_privacy_submit($form, &$form_state) {
  if (!array_key_exists('op', $form_state['values'])) {
    drupal_set_message(t('No operation?'), 'error');
    return;
  }
  if ('Purge now' == $form_state['values']['op']) {

    // First delete completly all that are published.
    db_delete('anonymous_publishing')
      ->condition('verified', 1)
      ->execute();

    // For the rest, delete the IP (we need e-mail for whitelist).
    db_update('anonymous_publishing')
      ->fields(array(
      'ip' => '',
    ))
      ->execute();
    drupal_set_message(t('All information linking identifiers to published content have been purged.'));
  }
  elseif ('Save setting' == $form_state['values']['op']) {
    variable_set('anonymous_publishing_cl_period', $form_state['values']['anonymous_publishing_cl_period']);
    drupal_set_message(t('Rentention period updated.'));
  }
  else {
    drupal_set_message(t('Unknown operation.', 'error'));
    return;
  }
}