Back in Drupal 4.7 if you were using CCK for nodes the node body was left empty. In Drupal 5 CCK nodes now can have a body. I wanted to move data from a field named description into the node body so I came up with the following snippet fit for running in the devel module's execute PHP block.
<?php
$result = db_query("SELECT nid FROM {node} WHERE type = 'content_problem'");
while ($o = db_fetch_object($result)) {
$node = node_load($o->nid);
if ($node) {
$node->body = $node->field_description[0]['value'];
$node->format = $node->field_description[0]['format'];
node_save($node);
}
print "$node->title<br>";
}
?>
Thank you
I have need this one: $node->format = $node->field_description[0]['format'];
and I have get it :)
thanks for sharing
Sooo helpful
I can't tell you how much time this saved me. I really appreciate you posting this.
-bryan kennedy
Woops, noticed one addition that would help
I actually added this one line.
$node->teaser = node_teaser($node->field_burst_body[0]['value']);So that the teasers would get saved along with the input to the body. Otherwise by teaser views were showing up blank.