it'd be cool if the review could render a CCK integer field as stars...

Comments

drewish’s picture

here's a code snipit to modify a review node to a cck node, providing that you've defined it with the same fields:

$node = node_load(array('nid'=>$nid, 'type'=>'review'));
if ($node) {
  $node->type = 'content_review';
  $node->field_description[0] = array(
    'value' => $node->body,
    'format' => $node->format,
  );
  $node->field_rating[0] = array(
    'value' => $node->review_rating,
  );
  node_save($node);
}
drewish’s picture

little fuller example:

$result = db_query("SELECT nid FROM {node} WHERE type = 'review'");
while ($o = db_fetch_object($result)) {
  $node = node_load($o->nid);
  if ($node) {
    $node->type = 'content_review';
    $node->field_description[0] = array(
      'value' => $node->body,
      'format' => $node->format,
    );
    $node->field_rating[0] = array(
      'value' => $node->review_rating,
    );
    node_save($node);
  }
  print "$node->title<br>";
}
duke_’s picture

This is very interesting, I've been trying to do this with no success. How do i have to use this code?

Thanks.

clarknova’s picture

Would you give me an idea on how to use this code, please?

drewish’s picture

that code is something you'd only need to run once. you could install the devel module, enable the php evaluation block, run that type of code (you'll probably need to tweak it depending on where the data is going), and then when you're finished uninstall the devel module.