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.

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.

Blog Module /

Discuss the Blog Module.

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

Allow comments - change default to off? [SOLVED]


Go to End


7 Posts   4641 Views

Avatar
Web Designer Perth

Community Member, 49 Posts

4 November 2009 at 1:01pm

Edited: 25/11/2009 3:21pm

For each blog entry, in the Behaviours tab, there is a tickbox defaulting to 'allow comments.'

Where can I change the default?

Does anyone know?

TIA

Avatar
Willr

Forum Moderator, 5523 Posts

4 November 2009 at 1:08pm

In BlogEntry.php at the top it is set in the $defaults array(). Look for something like

static $defaults = array(
'AllowComments'....

Set that to 0 / false to disable the comments by default.

Avatar
Web Designer Perth

Community Member, 49 Posts

4 November 2009 at 1:17pm

Thanks Willr - superfast!

Avatar
fabilo

Community Member, 10 Posts

7 January 2011 at 12:00pm

AllowComments didn't work for me, although ProvideComments did :)

Avatar
Johan

Community Member, 49 Posts

1 March 2011 at 11:05pm

This no longer works for me.

BlogEntry/php

	static $defaults = array(
		"ProvideComments" => false,
		'ShowInMenus' => false
	);

Avatar
mierla

Community Member, 16 Posts

8 April 2011 at 2:09am

Me neither - anyone got any suggestions?

Avatar
timwjohn

Community Member, 98 Posts

15 June 2011 at 2:35am

It did work for me, but I'm not a fan of changing the code in an external module, especially if pulling it in using svn:externals (or the git equivalent). Any fresh installation or update could potentially restore the change unnoticed.

A more sensible way to override the default is to add this line of code to mysite/_config.php:

BlogEntry::$defaults["ProvideComments"] = false;