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, biapar, Willr, Ingo, swaiba, simon_w

How to get rid of "Your website URL" field in post comment form


Reply


8 Posts   2891 Views

Avatar
mango

Community Member, 26 Posts

23 May 2009 at 5:51pm

Is there a way to get rid of "Your website URL" field in the post comment form without making changes to cms/code/sitefeatures/PageCommentInterface.php?

Avatar
PGiessler

Community Member, 47 Posts

23 May 2009 at 8:07pm

Hi

Go the PageComments class and delete this field in the Contoller. So this field won't be visible for anyone. I don't have enough time, to give you the whole path.

Best regards,

Pascal

Avatar
mango

Community Member, 26 Posts

24 May 2009 at 8:56pm

I'm looking for a solution without doing any changes to the code. Introducing solution in code is not ideal since it might disappear upon next update.

Avatar
PGiessler

Community Member, 47 Posts

25 May 2009 at 2:49am

Hi mango,

I read currently my last post and I have to detect, that my statement was very difficult to understand. Sorry. What I mean is that
you can write in your Page.php file or another php file. So you can overwrite the pagecomments, because you have a relation with methods on other class.

Best regards,

Pascal

Avatar
mango

Community Member, 26 Posts

25 May 2009 at 2:55am

Pascal, thanks for the pointer, I now understand what you mean. I guess I'll have to learn a bit more before overwriting pagecomments' behaviour. For the time being I'll just use CSS to display:none it.

Thanks again.

Avatar
orion

Community Member, 20 Posts

18 February 2010 at 5:01pm

I have a project where I need to upload text content to some pages of an unfinished site, while developing the rest of it. My concern is that when i update the site, will I overwrite all my content. Is there a way I can prevent this?

Thank you in advance!

Avatar
CHD

Community Member, 218 Posts

22 October 2010 at 4:42am

i always use this to remove the URL field....

#CommenterURL {
display:none;
}

Avatar
Myrdhin

Community Member, 67 Posts

5 November 2010 at 4:03am

Edited: 05/11/2010 4:04am

or you can :

1 - Create a file mysite/code/PageCommentInterfaceWithoutURL.php :

<?php

class PageCommentInterfaceWithoutURL extends PageCommentInterface{

   function PostCommentForm() {
      $form = parent::PostCommentForm();
      $fields = $form->Fields();
      $fields->removeByName('CommenterURL');
      $form->setFields($fields);
      return $form;
   }
}

?>

2 - and add this function in your Page_Controller class in mysite/code/page.php :

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