In _webform_submit_cc_email(), rather than doing:

  $cc_extra_field_mappings = explode(', ', variable_get('cc_extra_field_mappings'));
  foreach ($cc_extra_field_mappings as $key => $value) {
    $mapping = explode(':', $value);
    $mappings[$mapping[0]] = $mapping[1];
  }

How about doing:

  $cc_extra_field_mappings = explode(',', variable_get('cc_extra_field_mappings'));
  $cc_extra_field_mappings = array_map('trim', $cc_extra_field_mappings);
  $mappings = array();
  foreach ($cc_extra_field_mappings as $value) {
    list($dst, $src) = explode(':', $value, 2);
    $mappings[trim($dst)] = trim($src);
  }

The way it is written now means that you have to format the list exactly with a comma and single space between each element. In the new way, all we care about is the comma, and extra whitespace will automatically be trimmed off. Also, adding the limit to the second explode will help to make sure that we always get the entire second half.

Comments

attheshow’s picture

Category: Bug report » Feature request

Would you mind creating a patch for your suggested change? The instructions on creating a patch are here: http://drupal.org/patch/create