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.

General Questions /

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

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

Comment Form bug

Go to End

3 Posts   1032 Views


Community Member, 8 Posts

18 April 2012 at 9:18pm

I have this on my PageControllerDecorator:

public static $allowed_actions = array(

public function UserPageComments() {
	if($this->owner->data() && $this->owner->data()->ProvideComments) { 
		return new UserCommentInterface($this->owner, 'UserPageComments', $this->owner->data()); 
	} else { 
		if(isset($_REQUEST['executeForm']) && $_REQUEST['executeForm'] == 'UserPageComments.PostCommentForm') { 
			echo "Comments have been disabled for this page"; 

The problem is that whenever I submit the form, I get this error:

Action 'UserPageComments' isn't allowed on class Page_Controller

I've already made sure that the caches are flushed (even deleted) and ran dev/build.

I'm pretty sure this is an isolated case, or is just happening in my installation, because this custom comment interface was working before. No changes were made in the code but I'm working with other developers with other tasks on one project. I'm thinking this could be a result of some update the others have committed.

But I'm hoping someone could give any solution to this. Thanks.


Forum Moderator, 5523 Posts

20 April 2012 at 12:05am

In 2.4.* you need to use extraStatics() to define statics on extension classes. So you would have

function extraStatics() {
return array(
'allowed_actions' => array(

But! in saying that I don't think you can define a new action on a controller via an extension. I had issues with this when I implemented the comments module. I made a dedicated controller (not just an extension) which handled for form submission action (you can still display the form through the extension).


Community Member, 8 Posts

27 April 2012 at 9:26pm

Made this to work by creating a custom controller. Thank you so much for that suggestion!!!