function signup_webform_signup_cancel in Signup 6.2
Implementation of hook_signup_cancel().
When a signup is canceled, delete the corresponding webform submission.
File
- modules/
signup_webform/ signup_webform.module, line 332 - signup_webform.module
Code
function signup_webform_signup_cancel($signup, $node) {
$form_data = unserialize($signup->form_data);
foreach (_signup_webform_pane_ids($form_data) as $pane_id) {
// Load the webform API.
module_load_include('inc', 'webform', 'webform_submissions');
// Get the real nid from the prefixed pane ID and thence the node.
$webform_nid = substr($pane_id, 8);
$webform_node = node_load($webform_nid);
// Get the submission ID from the signup data and thence the submission.
$sid = $form_data[$pane_id]['sid'];
$submission = webform_get_submission($webform_nid, $sid);
// Delete the webform submission.
webform_submission_delete($webform_node, $submission);
// Delete the signup-webform submission relationship.
db_query("DELETE FROM {signup_webform_submission} WHERE signup_sid = %d", $signup->sid);
}
}