Permalink
Browse files

Merge pull request #37 from maihde/master

Added ~FieldName~ expansion to email subject in form submission.
  • Loading branch information...
2 parents dc6926c + 7da0100 commit a803be0629b4e42b9975df0030ae8b57d58c731c @warkior warkior committed Apr 26, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 php/formbuilder_processing.inc.php
@@ -1220,7 +1220,7 @@ function formbuilder_process_email($form, $fields)
$formBuilderTextStrings = formbuilder_load_strings();
-
+ $email_sub = $form['subject']; // mai - added
$email_msg = "";
$autoresponse_required = false;
$source_email = "";
@@ -1244,6 +1244,8 @@ function formbuilder_process_email($form, $fields)
{
$email_msg .= strtoupper(decode_html_entities($field['field_name'], ENT_QUOTES, get_option('blog_charset'))) . ": " . decode_html_entities($field['value'], ENT_QUOTES, get_option('blog_charset')) . "\r\n\r\n";
$field_values[$field['field_name']] = decode_html_entities($field['value'], ENT_QUOTES, get_option('blog_charset'));
+ // Populate ~variable~ tags in the form subject with values submitted by the user
+ $email_sub = str_replace("~" . $field['field_name'] . "~", $field_values[$field['field_name']], $email_sub); // mai - added
}
elseif($field['field_type'] == "recipient selection")
{
@@ -1313,7 +1315,7 @@ function formbuilder_process_email($form, $fields)
if(!$source_email) $source_email = get_option('admin_email');
return(formbuilder_send_email(
$form['recipient'],
- decode_html_entities($form['subject'], ENT_QUOTES, get_option('blog_charset')),
+ decode_html_entities($email_sub, ENT_QUOTES, get_option('blog_charset')),
$email_msg,
"From: " . $source_email . "\nReply-To: " . $source_email . "\n"));

0 comments on commit a803be0

Please sign in to comment.