This snippit allows you to bulk enable or disable comments for nodes through the database.
SQL to disable comments for all nodes of type "story":
UPDATE node SET comment = 0 WHERE type LIKE "story";
comment = 2 would mass enable read/write
comment = 1 would mass enable just read
You can change "story" to "page" or whatever you'd like.
An alternate solution using Drush
Shows what node types have been created:
drush sql-query "SELECT DISTINCT type FROM node ORDER BY type"
Shows what node types have been created that have comments enabled:
drush sql-query "SELECT DISTINCT type FROM node WHERE comment <> 0 ORDER BY type"
Shows nodes titles that have comments enabled:
drush sql-query "SELECT title, type, comment FROM node WHERE comment <> 0 ORDER BY type"
Drush SQL query to disable comments for all nodes of type "story":
drush sql-query "UPDATE node SET comment = 0 WHERE type LIKE 'story'"
An alternate solution using Views Bulk Operations
A different method would be using VBO. Admin Views provides an out-of-the-box replacement for your main content list using VBO (but you can use VBO without Admin Views also). You can then:
- select all the nodes you want
- choose the operation: Change value and click [execute]
- choose the value to modify (comments allowed), click [next]
- set value to 0 or 1 or 2
Comments
thanks
that is exactly what I need
Well, yes. But...
Well, yes. But...
-- Would love to provide a UI to choose a large number of nodes, but not all of a type.
-- I prefer not to do this kind of thing in production.
D7
http://drupal.org/node/103064#comment-4922950
You wanna do this via the
You wanna do this via the abstraction layer, do ya?
Yeah, I know you do.
That's why I'm here to help you out, friend!!
I couldn't figure out how to do a join in a db_update.
Is it possible?
You need to change the
You need to change the setting in the node revisions table as well. Maybe something like the following in addition to the original query:
content2zero.com
Update node tables as well
Why don't you update and the
node
table, so to be:is it wrong to do so, or is there any difference or it will be updated (the
node
table) on some future node save through the UI ?Thank you ! A lot easier than using boring unclear VBO !
Thank you ! A lot easier than using boring unclear VBO !
An example - a summary of both steps:
Here's a complete example for a content type called "toolkit" in D7. This will turn on comments on all content types on your site:-
Setting to zero rather than 2 turns them off.
Hope it's helpful.
Thank you, it is good example
Thank you, it is good example and it works.
--
Drupal sites and server support - https://drupal-admin.com
here's how to set all
here's how to set all comments to read only after they are 3 months old
No module to batch enable or disable comments
No module to batch enable or disable comments
Hello,
Nobody has ever made a module to enable comments or disable comments ?
Thank you.
For Drupal 7, try disabling
For Drupal 7, try disabling the core comment module.
Bad idea
Bad idea if you happen to have comments on any views it will throw an error.
venusrising