I recently enabled the comments module and noticed all our content types have comments enabled by default. Also, when I go to create a new content type, it has comments enabled by default. I only want one or two content types to allow comments. Is there an easy way to have comments disabled by default and force the administrator(s) to manually enable them for a content type if they desire?

Rob

Comments

feloescoto’s picture

Hello, when you are at yoursite.com/content/types/yourtype

at 'Default comment setting:' you set it to 'Disabled'

When you are creating it, it will probably offer you to enable them, but that is precisely where you disable them.

Now, the user must have 'administer comments' rights to enable comments in his post, on a per case basis.

That should get you started, let me know if that helps.

Regards,
Felipe

Geeks Socializing
http://inTribu.com

rgraves’s picture

Thanks. I understand that part, but what I'm concerned about is the following:

1. We have a couple of Drupal administrators here and there's the possibility one might accidentally leave comments enabled
2. If we install another module that automatically creates it's own content type, won't that content type have comments enabled by default?

I know I can manually go into each content type and disable them, but I'm hoping there's a way to have them disabled for any new content type by default so that it's one less thing we have to do when we create new sections on our site.

Rob

feloescoto’s picture

I see, well, there is a way to hack it, I don't know if there is a setting to control this, I looked for it, but I didn't find any.

Go to 'modules/comment/comment.module' in your installation directory and look for line 375 there you will find this:

'#default_value' => variable_get('comment_'. $form['#node_type']->type, COMMENT_NODE_READ_WRITE),

replace it with this:

'#default_value' => variable_get('comment_'. $form['#node_type']->type, COMMENT_NODE_DISABLED),

That will set the comments to be disabled by default, that is when you create a new content type, I would not know if a new module will read this setting, that you would have to confirm on a one by one basis.

Hope it helps, let me know.

Geeks Socializing
http://inTribu.com

rgraves’s picture

Worked. Thanks.