Jump to:
| Project: | Rules |
| Version: | 7.x-2.2 |
| Component: | Documentation |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Hi.
I'm trying to set a field's value with the value of another field, with the php filter.
On visualizing a content, the rule must get the field of the node.
I type:
$a = field_get_items('article', $node, 'field_unixtimestamp');
but i get: Notice: Undefined variable: node in eval() (linea 1 di /home/tcbkitrp/public_html/sites/all/modules/rules/modules/php.eval.inc(146) : eval()'d code).
how to set $node to the value of the current node?
oooooookey, solved, sorry, i was using $node in the wrong place.
now, the problem is: how to set the value of the field?
the code:
//get array timestamp
$a = field_get_items('node', $node, 'field_unixtimestamp');
//get timestamp value
$b = $a[0]['value'];
//get array date
$value = field_get_items('node', $node, 'field_date');
//set date value to timestamp value
$value[0]['value'] = $b;
return $value;
and then?
Comments
#1
You do not need to code this. Just use actions in data.