You are here

function certificate_admin_clear_form_submit in Certificate 8.3

Same name and namespace in other branches
  1. 6.2 certificate.admin.inc \certificate_admin_clear_form_submit()
  2. 6 certificate.admin.inc \certificate_admin_clear_form_submit()
  3. 7.2 certificate.admin.inc \certificate_admin_clear_form_submit()
  4. 4.x certificate.admin.inc \certificate_admin_clear_form_submit()
  5. 3.x certificate.admin.inc \certificate_admin_clear_form_submit()

Delete selected certificate snapshots.

File

./certificate.admin.inc, line 463
Administrative pages for Certificate module.

Code

function certificate_admin_clear_form_submit(&$form, &$form_state) {
  $nids = array();
  foreach ($form_state['values']['nids'] as $nid => $delete) {
    if ($delete) {
      $nids[] = $nid;
    }
  }
  if (count($nids)) {
    db_delete('certificate_snapshots')
      ->condition('nid', $nids, 'IN')
      ->execute();
    drupal_set_message(t('Cleared certificate snapshots.'));
  }
  else {
    drupal_set_message(t('No items selected.'), 'error');
  }
}