I've run into a problem with the custom subject lines in Webform.

In Drupal 5.12 with Webform 5.x-2.3, if I specify a custom subject that includes the %title token, the token is not replaced. Instead, the text "%title" appears in the email header.

If I check the default option ("Form submission from: %title") then the script works properly and the name of the form is added to the subject line.

Comments

NukeHavoc’s picture

After stepping through the problem, I think the issue lies in this section of the code:

if ($node->webform['email_'. $field] == 'default') {
        ${'email_'. $field} = _webform_filter_values(webform_variable_get('webform_default_'. $field), $node, $form_values['submitted']);
      } elseif (is_numeric($node->webform['email_'. $field])) {
        ${'email_'. $field} = _webform_filter_values($form_values['submitted'][${'email_'. $field}], $node, $form_values['submitted']);
      }

It's looking for a default value for the field or a numeric value for the field, but if it's not one of those cases, the field passes through and is not filtered. If there's a token in the field, then it will pass through this loop and emerges in the email unchanged. There needs to be another conditional statement to deal with 'custom' subjects.

NukeHavoc’s picture

I haven't had a chance to delve back into the code yet, but can anyone else confirm that this is happening with their installs?

wansinn’s picture

its happening with me too...

quicksketch’s picture

Status: Active » Fixed

This is now fixed: http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/webform/web...

You can download the dev version from the releases page to correct the problem, wait for 2.4 to be released, or apply the above patch.

Rob T’s picture

Just wanted to note that for me, the dev version (6.x-2.x-dev from Dec. 19) while the subject issue was resolved, I instead encountered a problem with the email showing no submitted components.

I went back to 6.x-2.3 and hand patched the file as you mentioned, and all seems good.

Of course, right as I post this, I see that this issue is for 5.x version. My bad. Patch still worked for my subject line issue.

Status: Fixed » Closed (fixed)

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