Jump to:

10930 Posts in 2613 Topics by 1810 members

All other Modules

SilverStripe Forums » All other Modules » Userforms: set the subject

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 956 Views
  • Big Bang Creative
    Avatar
    Community Member
    92 Posts

    Userforms: set the subject Link to this post

    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?

  • baba-papa
    Avatar
    Community Member
    279 Posts

    Re: Userforms: set the subject Link to this post

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

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Userforms: set the subject Link to this post

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

  • Big Bang Creative
    Avatar
    Community Member
    92 Posts

    Re: Userforms: set the subject Link to this post

    I'm running v2.3.1 though and cannot upgrade.

    How can I hard code this?

  • baba-papa
    Avatar
    Community Member
    279 Posts

    Re: Userforms: set the subject Link to this post

    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.

  • Big Bang Creative
    Avatar
    Community Member
    92 Posts

    Re: Userforms: set the subject Link to this post

    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.

  • baba-papa
    Avatar
    Community Member
    279 Posts

    Re: Userforms: set the subject Link to this post

    Then you should upgrade or implement that function by youself.

  • Big Bang Creative
    Avatar
    Community Member
    92 Posts

    Re: Userforms: set the subject Link to this post

    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).

    956 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.