Jump to:

23481 Posts in 18951 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Comment Form bug

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: 517 Views
  • Lou
    Community Member
    8 Posts

    Comment Form bug Link to this post

    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.

  • Willr
    Forum Moderator
    5503 Posts

    Re: Comment Form bug Link to this post

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


  • Lou
    Community Member
    8 Posts

    Re: Comment Form bug Link to this post

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

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.