You are here

function _webform_results_clear_submit in Webform 5

File

./webform.inc, line 60

Code

function _webform_results_clear_submit($form_id, $form_values) {
  db_query('DELETE FROM {webform_submitted_data} WHERE nid = %d', $form_values['nid']);
  db_query('DELETE FROM {webform_submissions} WHERE nid = %d', $form_values['nid']);
  $node = node_load(array(
    'nid' => $form_values['nid'],
  ));
  $title = $node->title;
  $message = t('Webform %title entries cleared.', array(
    '%title' => $title,
  ));
  drupal_set_message($message);
  watchdog('webform', $message, WATCHDOG_NOTICE);
  drupal_goto('admin/content/webform');
}