function webform_results_clear in Webform 7.4
Same name and namespace in other branches
- 5.2 webform_report.inc \webform_results_clear()
- 6.3 includes/webform.report.inc \webform_results_clear()
- 6.2 webform_report.inc \webform_results_clear()
- 7.3 includes/webform.report.inc \webform_results_clear()
Delete all submissions for a node.
Parameters
$nid: The node id whose submissions will be deleted.
$batch_size: The number of submissions to be processed. NULL means all submissions.
Return value
int The number of submissions processed.
2 calls to webform_results_clear()
- drush_webform_clear in ./
webform.drush.inc - Clears a webform via drush.
- webform_clear_batch_rows in includes/
webform.report.inc - Batch API callback; Write the rows of the export to the export file.
File
- includes/
webform.report.inc, line 342 - This file includes helper functions for creating reports for webform.module.
Code
function webform_results_clear($nid, $batch_size = NULL) {
$node = node_load($nid);
$submissions = webform_get_submissions($nid, NULL, $batch_size);
$count = 0;
foreach ($submissions as $submission) {
webform_submission_delete($node, $submission);
$count++;
}
return $count;
}