5095 Posts in 1518 Topics by 1114 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1903 Views |
-
Is there an elegant way to turn off comments globally

24 February 2009 at 11:52am
Hi,
Is there an elegant simple way to turn off comments in all pages and remove the comments tab from the CMS ?
Thank you
Cheers
Robin
-
Re: Is there an elegant way to turn off comments globally

6 March 2009 at 4:56pm
Hi Robin,
Add a few lines (in green) to /mysite/code/Page.php to the Page class:
class Page extends SiteTree {
public static $db = array(
);
public static $has_one = array(
);static $defaults = array(
'ProvideComments' => false
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->removeFieldFromTab("Root.Behaviour","ProvideComments");
return $fields;
}}
To remove the comments tab this should work (add this to your /mysite/_config.php file):
Object::addStaticVars('LeftAndMain', array(
'removed_menu_items' => array(
'comments'
),
));I read somewhere that Silverstripe 2.3 uses
LeftAndMain::remove_menu_item('comments');
orCMSMenu::remove_menu_item()
Not sure which one works for your version of Silverstripe.
Cheers!
Anatol -
Re: Is there an elegant way to turn off comments globally

6 March 2009 at 5:45pm
Hi Anatol,
Great thank you
Cheers
Robin
-
Re: Is there an elegant way to turn off comments globally

14 October 2009 at 12:13pm
Silverstripe 2.3.3...to remove from the main tabs...
CMSMenu::remove_menu_item('CommentAdmin');
| 1903 Views | ||
|
Page:
1
|
Go to Top |


