You are here

function hook_webform_submission_insert in Webform 7.3

Same name and namespace in other branches
  1. 6.3 webform.api.php \hook_webform_submission_insert()
  2. 7.4 webform.api.php \hook_webform_submission_insert()

Respond to a Webform submission being inserted.

Note that this hook is called after a submission has already been saved to the database. If needing to modify the submission prior to insertion, use hook_webform_submission_presave().

Parameters

$node: The Webform node on which this submission was made.

$submission: The Webform submission that was just inserted into the database.

Related topics

1 function implements hook_webform_submission_insert()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

webform_webform_submission_insert in ./webform.module
Implements hook_webform_submission_insert().
1 invocation of hook_webform_submission_insert()
webform_submission_insert in includes/webform.submissions.inc
Insert a webform submission entry in the database.

File

./webform.api.php, line 134
Sample hooks demonstrating usage in Webform.

Code

function hook_webform_submission_insert($node, $submission) {

  // Insert a record into a 3rd-party module table when a submission is added.
  db_insert('mymodule_table')
    ->fields(array(
    'nid' => $node->nid,
    'sid' => $submission->sid,
    'foo' => 'foo_data',
  ))
    ->execute();
}