Deshabilite los comentarios aquí primero:
structure->content types->{node_type}->edit->comment settings
Para actualizar los nodos, desafortunadamente, debe volver a guardar cada nodo. Use hook_update a continuación:
/**
* Disable comments on node_type
*/
function hook_update_N(&$sandbox) {
$content_type = 'node_type';
// Initialize batch.
if (!isset($sandbox['total'])) {
$query = db_select('node');
$query->addExpression('COUNT(*)');
$query->condition('type', $content_type);
$sandbox['total'] = $query->execute()->fetchField();
$sandbox['progress'] = 0;
if (empty($sandbox['total'])) {
$sandbox['#finished'] = 1;
return t('No %type nodes exist in database.', array('%type' => $content_type));
}
}
// Get and update nodes.
$nids = db_select('node')
->fields('node', array('nid'))
->condition('type', $content_type)
->range(0, 10)
->execute()
->fetchCol();
if (!empty($nids)) {
$nodes = node_load_multiple($nids, NULL, TRUE);
foreach ($nodes as $node) {
$node->comment = 1; // I set comments as 1 where value of 2 enables the comments.
node_save($node); // Re-save the node.
}
}
// Increment & check progress.
$sandbox['progress'] += count($nids);
if (empty($nids) || $sandbox['progress'] >= $sandbox['total']) {
$sandbox['#finished'] = 1;
return t('Updated @count nodes.', array('@count' => $sandbox['progress']));
}
else {
$sandbox['#finished'] = $sandbox['progress'] / $sandbox['total'];
}
}
No olvide reemplazar 'node_type' a su tipo de nodo.
UPDATE node SET comment = 0; UPDATE node_revision SET comment = 0
. Trabajó para mi :-).