Project:Review
Version:master
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

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

Comments

#1

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

<?php
$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);
}
?>

#2

little fuller example:

<?php
$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>";
}
?>

#3

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

Thanks.

#4

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

#5

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.