4

I have a whole bunch of nodes (all the same type), and I'd like to turn comments on for all of them (the client changed their mind about commenting after all of the data was added).

I've found notes that suggest that if I do something like:

update node set comment = 2 where type = 'foo'

then it should turn commenting on for all the nodes of type foo. However, this doesn't seem to work in Drupal 7, and the notes on drupal's site only specify 5 and 6.

I tried flushing caches and bouncing apache after making the change, and still can't see comments coming back on. Did this change in Drupal 7?

0

2 Answers 2

7

That will work; don't forget node_revision.

UPDATE NODE SET comment = 2 WHERE type = 'foo'
UPDATE node_revision SET comment = 2 WHERE nid IN (SELECT nid FROM node WHERE type = 'foo')
1
  • 1
    Great. I do a lot of back-end work on the Drupal tables. Regarding content, there's nearly always a base table as well as a revision table that needs to be updated.
    – Mike
    Jun 2, 2011 at 16:08
12

I'd also recommend Views Bulk Operations. You could create a view with a filter of that content type and add enable comments as an action. Then it offers you to select all.

Quite the useful admin tool.

1
  • Views Bulk Operations is a fantastic module and well worth getting to know.
    – cam8001
    Jun 3, 2011 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.