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.

Customising the CMS /

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

Extending PageComment_Controller


Go to End


2 Posts   1282 Views

Avatar
aa

Community Member, 1 Post

19 January 2010 at 7:30pm

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

Avatar
MateuszU

Community Member, 89 Posts

1 February 2010 at 10:16am

Edited: 01/02/2010 10:17am

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