I'm new to Drupal but relatively proficient in PHP. I'm attempting to use the Webform module as a ticketing system. What I'd like to do is hook into the webform submission insert (hook_webform_submission_insert) and create an object of type 'support_ticket' each time a webform is saved. For now, I'm just trying to make sure that I'm hooking in properly, and it looks like I'm not. I'm using the code below in a template.php file of a custom module:

function pvfk_webform_submission_insert($node, $submission){
   drupal_set_message("IN Insert");

   //Declare a new StdObj

   $new_node = new StdObj();
   //Set the type

   //Set the Title
   $new_node->title='NEW TICKET';

   //Set the body
   $new_node->body = 'TICKET BODY';

   //Set other content fields
   // $new_node->field_name[0]['value'];

   //Finally use functions to save, submit, and insert the new_node
   $new_node = node_save($new_node);

I've cleared my cache and created new webforms - but neither a new piece of content is created nor do I see the message. Am I missing something here?

2 Answers 2


Hook functions are run only when they are put inside a .module file.

So you should move your function into your pvfk.module file. Then visit your /admin/build/modules list so Drupal will refresh hooks list.


Moved it to the module as suggested by ermannob. Still wasn't firing, finally realized the prefix should have been pfvk and not pvfk...lesson learned.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.