I am trying to make the fivestar Node ID target field be set to a node_reference cck field. Does anybody know if this is possible, and if so what the code for the Node ID field in the rating field should be? I tried the following which did not work:
return $node->field_reference_place_add_node[0][value];

Comments

OwnSourcing’s picture

subscribe

aaustin’s picture

Try:

return $node->field_reference_place_add_node[0]['nid'];
quicksketch’s picture

Status: Active » Fixed

This previously was not possible because Fivestar was using drupal_eval() to call the PHP code. This means that the code did not have access to any of the local variables (such as $node). I've switched this to a normal eval() call so the $node variable is now available. This should be in the 1.11 final release and in beta 4 to be posted shortly.

After upgrading, the solution posted by aaustin should work.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

welzie’s picture

Worked for me! Thx for posting solution aaustin.

My target code looks like the below. Note: "field_car" is the name of the node reference field.

return $node->field_car[0]['nid'];

Using:
drupal 5.7
cck 5.x-1.7
fivestar 5.x-1.12
votingapi 5.x-1.6

Energyblazar’s picture

Version: 5.x-1.7 » 7.x-2.0-alpha2
Status: Closed (fixed) » Active

How do the same in drupal 7.

tr’s picture

Issue summary: View changes
Status: Active » Closed (outdated)