I'm trying to send email for more than one submission during a page load. However, _webform_filter_values caches all tokens in static variable. So, all variables except %email_values has correct values only for the first submission.

Also there is the a bug in Webform2PDF because of this problem.

Can we add $reset parameter to _webform_filter_values?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

Priority: Normal » Minor

In Drupal 7, the preferred approach is to use a drupal_static() call, which will allow you to reset a variable without adding an additional parameter to the function. See http://api.drupal.org/drupal_static. If you're interested in writing patch I'd be happy to review it.

I'm moving this to minor because it doesn't affect normal functionality of the module.

iSampo’s picture

Hi!

I'm working on Webform Mass Email and also bumped on this when trying to use the _webform_filter_values function.

Here's a patch for Webform that converts the replacement values to use drupal_static. I don't really know where other places _webform_filter_values() is used, so I couldn't test that much. To me this approach worked and I was able to reset the variable using drupal_static_reset('_webform_filter_values'). Is this the right way? Thanks!

quicksketch’s picture

Status: Active » Needs review

Thanks, great idea. I'll apply this next pass through the queue.

quicksketch’s picture

Status: Needs review » Fixed

Thanks, committed to 7.x-3.x branch. This isn't necessary in the 4.x branch because it uses the D7 token system.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Reason->problem