Hi,

In drupal 6 I added a function to save data from this module into every single webform submission (on DB and not only on email), using a custom module:

function MYMODULENAME_webform_submission_presave($node, &$submission) {
  // Update some component's value before it is saved.
  
  $body_footer = theme('contact_google_analytics_footer', $footer);
  $body_footer = token_replace_multiple($body_footer);

  $component_id = 8;
  $submission->data[$component_id]['value'][0] = $body_footer;
}

All works fine and all data from $body_footer are placed into an hidden field ($component_id = 8;) and saved correctly to my DB.

But now with drupal 7 I had got an error:

Fatal error: Call to undefined function token_replace_multiple() in /var/wwwroot/MYSITE/sites/all/modules/MYMODULENAME/custom.module on line 7

Someone could help me to integrate back this function?

Thanks!

Comments

Brian294’s picture

Try using token_replace. token_replace_multiple is no longer a valid function in Drupal 7's token.
http://api.drupal.org/api/drupal/includes!token.inc/function/token_repla...

Peace,
Brian

Dret’s picture

Thanks, it works.

But now give me another error in the previous line:

$body_footer = theme('contact_google_analytics_footer', $footer);

Any idea about?

Dret’s picture

Is there anybody out there?? :)

At the moment the problem is still present and after every webform sending this error message appear:

Notice: undefined variable:footer in custom_webform_submission_presave() line 7

Line 7 is: $body_footer = theme('contact_google_analytics_footer', $footer);

Brian294’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

I have written another module to do something similar to what you have requested. It's called GA Capture.
https://drupal.org/project/ga_capture

I am seeking sponsorship to develop the webform submodule, take a look:
https://drupal.org/node/2165325

Peace,
Brian

Brian294’s picture

I wrote the module, it is available here: https://drupal.org/project/ga_capture