Hey everyone,

My question is Exactly What It Says On The Tin. I've googled for many days without an answer. (can it actually be done?)

Cheers, and thanks for all your help.
Léster

Comments

WorldFallz’s picture

not sure how you googled, but one of the first links i found was: http://drupal.org/node/575034.

Raf’s picture

Just out of curiosity... Why do they use LIKE and not = in the query?

sarav.din33’s picture

Hi lbelloq,..

I need some clarification about your requirement..

Whether you created any content by using your custom content type with "Comment Enable : Read/Write" settings? or Here after you create content with "Comment Disable" settings?..

Why i ask this means, already you created content with "Comment Enable" settings, then you use the "UPDATE" query for removing(Disable) the comment settings..

By using the following query,

UPDATE node SET comment = 0 WHERE type LIKE "story";

Since you didn't create any content means you didn't disable the comment settings through coding. But you can do through interface in content type settings page..

I hope this is helpful for you...

Thanks & Regards,
Sarav..

Thanks & Regards
Sarav..

lbelloq’s picture

Thanks for your help.
The problem is, I've coded a custom content type but I want to programatically disable comments in my content type. Like, adding a sentence in the .install or .module file that automatically will disable comments when I enable the module.
And that's it. Sorry for not explaining myself properly before, ahaha~

m4olivei’s picture

To do that set the variable named: comment_my_node_type to '1'.

So in your hook_install function:

function my_module_install() {
  variable_set('comment_my_node_type', '1');
}

Replacing 'my_node_type' with the name of your node type obviously. Give that a try.

Thanks,
Matt

alienresident’s picture

You can also do this with drush
drush vset comment_my_node_type 0 -y

Note: 0 = disabled, 1 = Read Only, 2 = Read and Write