From 459c127d51ed739677ca1ab6f545abb1e7687c8d Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Wed, 11 Feb 2009 02:27:55 +0000 Subject: [PATCH] ENHANCEMENT: can now send submitted data (via email) to submitter and site owner individually or both at the same time --- code/UserDefinedForm.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/code/UserDefinedForm.php b/code/UserDefinedForm.php index 28fec25..a95cfb8 100755 --- a/code/UserDefinedForm.php +++ b/code/UserDefinedForm.php @@ -371,13 +371,14 @@ class UserDefinedForm_Controller extends Page_Controller { } - if( $this->EmailOnSubmit || $sendCopy ) { - $emailData = array( - "Recipient" => $this->EmailTo, - "Sender" => Member::currentUser(), - "Fields" => $submittedFields, - ); - + // Extract email data + $emailData = array( + "Recipient" => $this->EmailTo, + "Sender" => Member::currentUser(), + "Fields" => $submittedFields, + ); + + if( $this->EmailOnSubmit ) { $email = new UserDefinedForm_SubmittedFormEmail($submittedFields); $email->populateTemplate($emailData); $email->setTo( $this->EmailTo ); @@ -391,7 +392,9 @@ class UserDefinedForm_Controller extends Page_Controller { } $email->send(); - + } + + if($sendCopy) { // send to each of email fields $emailToSubmiter = new UserDefinedForm_SubmittedFormEmailToSubmitter($submittedFields); $emailToSubmiter->populateTemplate($emailData);