Hi all, I have two content type "foo" and "bar". When I update a "foo" node I need to get two values from a foo's fields (cck integer and node reference) and update the referenced node of type "bar".
To do this I use "rules" module with a PHP custom function, but I have a problem: $node and $node_unchanged have the same values. I have tried the token version (always rules module): "[node:field_costo_importo-raw]" and "[node_unchanged:field_costo_importo-raw]". But I have the same result: both have the same value.
Where is the error ?
M.
If you're comfortable writing PHP, this should probably be in a custom module leveraging hook_node_insert/update (or hook_nodeapi in Drupal 6).
http://api.drupal.org/api/drupal/modules--node--node.api.php/function/hook_n... http://api.drupal.org/api/drupal/modules--node--node.api.php/function/hook_n...
http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_no...
Carl Wiedemann Website design and development consulting carl.wiedemann@gmail.com | skype: c4rlww
Il 21/09/11 17.15, Carl Wiedemann ha scritto:
If you're comfortable writing PHP,
yes,
this should probably be in a custom module leveraging hook_node_insert/update (or hook_nodeapi in Drupal 6).
No. hook_nodeapi works on the new node "version" (new data). I need the old value and the new value. The work is simple: get "foo" field value from node A via "nodereference" field, subtract 'bar' field from "old node" and add 'bar' field from "new node" , save the node A with the new value of the "foo" field.
Sorry for my bad english.
M. -- Michel 'ZioBudda' Morelli michel@ziobuddalabs.it Sviluppo applicazioni CMS DRUPAL e web dinamiche (LAMP+Ajax) 0200619074 - 3939890025 (mobile)-- Fax: +39-0291390660 http://www.ziobuddalabs.it Skype: zio_budda