Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Userforms: set the subject


Go to End


8 Posts   1495 Views

Avatar
Big Bang Creative

Community Member, 92 Posts

10 June 2009 at 10:44pm

Currently the subject of the email I get is "Contact Form" which is the page name.

I can see in SubmittedFormEmail.ss <h1>$Subject</h1> which I can change for the body of the email but what about the actual subject of the email? it would be good if I could change this in the CMS, can this be done?

Avatar
baba-papa

Community Member, 279 Posts

11 June 2009 at 7:56pm

You need to change the php-code. There is no way to change the email´s title in the cms.

Avatar
Willr

Forum Moderator, 5523 Posts

11 June 2009 at 8:00pm

If you use the recently released 0.2 version of user forms then you can customize the subject heading in the cms.

Avatar
Big Bang Creative

Community Member, 92 Posts

11 June 2009 at 8:04pm

I'm running v2.3.1 though :-( and cannot upgrade.

How can I hard code this?

Avatar
baba-papa

Community Member, 279 Posts

13 June 2009 at 12:30am

In UserDefinedForm.php you have the following lines:

if( $this->EmailOnSubmit ) {
			$email = new UserDefinedForm_SubmittedFormEmail($submittedFields);			
			$email->populateTemplate($emailData);
			$email->setTo( $this->EmailTo );
			$email->setSubject( $this->Title );

Change
$this->Title
to the string you want to have as subject of the email. Do the same some lines below for the $emailToSubmiter object. That´s it.

Avatar
Big Bang Creative

Community Member, 92 Posts

16 June 2009 at 8:11pm

I have already figured that out, but I'd really like this to be set in the CMS for each userform. It's no good setting the subject to lets say "Contact Form Submission" when I have another form which is not a contact form.

Avatar
baba-papa

Community Member, 279 Posts

16 June 2009 at 11:00pm

Then you should upgrade or implement that function by youself.

Avatar
Big Bang Creative

Community Member, 92 Posts

17 June 2009 at 8:28pm

For those that do not know v0.2 of user forms will let you dynamically set the subject, from address, to address all from the CMS.

However User Forms v.0.2 requires SS 2.3.2 beta, which has not yet been released as a stable version. It will NOT work with the current release (v.2.3.1).