Jump to:

23493 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » How to change the 'Subject' of the default passwordreset email template?

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 597 Views
  • tfliam
    Avatar
    Community Member
    20 Posts

    How to change the 'Subject' of the default passwordreset email template? Link to this post

    Hi,

    Is that possible to change the 'Subject' of the default passwordreset email template without touching the original code?

    I found the code reside in Sapphire/Security/Member.php as show below:

    /**
    * Class used as template to send the forgot password email
    * @package sapphire
    * @subpackage security
    */
    class Member_ForgotPasswordEmail extends Email {
    protected $from = ''; // setting a blank from address uses the site's default administrator email
    protected $subject = '';
    protected $ss_template = 'ForgotPasswordEmail';

    function __construct() {
          parent::__construct();
       $this->subject = _t('Member.SUBJECTPASSWORDRESET', "Your password reset link", PR_MEDIUM, 'Email subject');
    }
    }

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: How to change the 'Subject' of the default passwordreset email template? Link to this post

    You can create your own custom Member_ForgotPasswordEmail and tell to use your class.

    ..

    class MyMember_ForgotPasswordEmail extends Member_ForgotPasswordEmail {

    function __construct() {
    parent::__construct();

    $this->subject = "Hi!";
    }
    }
    ..

    In your _config.php

    Object::useCustomClass('Member_ForgotPasswordEmail', 'MyMember_ForgotPasswordEmail');

  • tfliam
    Avatar
    Community Member
    20 Posts

    Re: How to change the 'Subject' of the default passwordreset email template? Link to this post

    Hi Willr,

    It works perfectly fine, thanks!

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