Adding Date & Time Stamp to Subject line of Form Submission Email

Permalink
I want to add a date & time stamp into the subject line for a form submission email. Right now every form submission has the same subject, and I need a way of making each subject unique. I figure a date & time stamp would be the simplest solution. I tried various php code insertions, but unfortunately I'm not familiar enough with php to get this to work.

I know I have to edit this line in blocks/form/controller.php, but I don't know what to how to change it without it breaking:

$mh->setSubject(t('%s Form Submission', $this->surveyName));


I found this page on the Date helper, but when I tried inserting variations of the code in controller.php, my form stopped working:http://www.concrete5.org/documentation/developers/helpers/date-and-...

Thank you for your help.

 
CDMadmin replied on at Permalink Reply
I figured out how to REPLACE the text subject with the date and time by adding this...

$today = date("F j, Y, g:i a");


...And changing the setSubject to:

$mh->setSubject($today);


However, I cannot figure out how to have both a text string and $today. When I try to combine them the submission breaks.
CDMadmin replied on at Permalink Reply
I figured out the solution: use %s for string replacement.

$mh->setSubject (t("WEB UPDATE: %s", $today));


Returns the subject: "WEB UPDATE: July 24, 2012, 5:09 pm"