Jump to:

5450 Posts in 1672 Topics by 1197 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: 783 Views
  • aa
    Avatar
    Community Member
    1 Post

    Extending PageComment_Controller Link to this post

    Hello,

    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,

    Simon

  • MateuszU
    Avatar
    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.

    cheers
    mat

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