You are here

function anonymous_publishing_pet_admin_privacy_submit in Anonymous Publishing 7

Submit for the anonymous_publishing_admin_privacy form.

File

modules/pet/anonymous_publishing_pet.module, line 109
Main hooks for Anonymous Publishing PET module.

Code

function anonymous_publishing_pet_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']) {
    db_truncate('anonymous_publishing_realname')
      ->execute();
    drupal_set_message(t('All real name records have been purged.'));
  }
  elseif ('Save setting' == $form_state['values']['op']) {
    variable_set('anonymous_publishing_pet_period', $form_state['values']['anonymous_publishing_pet_period']);
    drupal_set_message(t('Rentention period updated.'));
  }
  else {
    drupal_set_message(t('Unknown operation.', 'error'));
    return;
  }
}