Jump to:

5542 Posts in 1739 Topics by 1225 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Extending PageComment_Controller

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

Page: 1
Go to End
Author Topic: 815 Views
  • aa
    Community Member
    1 Post

    Extending PageComment_Controller Link to this post


    We need to extend the approve function inside PageComment_Controller (cms/code/sitefeatures/PageComment.php). Does anyone know how to extend this class so we can send emails once a comment is approved?

    Thank you in advance,


  • MateuszU
    Community Member
    89 Posts

    Re: Extending PageComment_Controller Link to this post

    Maybe you can try like that:
    1. Create MyPageComment_Controller as class extending the PageComment_Controller and redefining the approve function.
    2. Redefine the original rule leading to PageComment controller, but with higher priority:

    Director::addRules(49, array(
       'PageComment//$Action/$ID' => 'MyPageComment_Controller',

    That should hopefully direct the requests to the proper place. Don't forget to dev/build so the sapphire picks up the new class. Let us know how did you get on with that.


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.