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?
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.
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
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.
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
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.
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!
i always use this to remove the URL field....
#CommenterURL {
display:none;
}
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();
}
}
}