21 April 2011

You can enable or disable comments programmatically. Get node using node_load, set comment value and save node.

Source code viewer
  1. <?php
  2. #load node using node id
  3. $node = node_load($nid);
  4.  
  5. #0 - disabled; 1 - read only; 2 - read/write
  6. $node->comment = 2;
  7.  
  8. #save the node
  9. $node_save($node);
  10. ?>
Programming Language: PHP