Update Comment Status of a Node

Just recently I had the issue where a list of nodes imported via user import as a content profile had comment status disabled.

There were thousand of nodes to update, hence the best way was to use VBO. However, there was no option provided for comment status update, hence the alternative was to execute "Arbitrary PHP Code".

The following snippet below can be used for updating node status for nodes selected in VBO:

<?php
$object
->comment = COMMENT_NODE_READ_WRITE;
node_save($object);
?>

Happy Drupaling!
--
External Links: http://drupal.org/node/673828