I have a content type, Job Offer, and this node type is able to expire thanks to Node Expire module.
When editing a Job Offer, I want to change the expire date by the value of the Duration field that I added to this node.
In order to do this, I made a rule with the help of Rules Module and I am using the custom PHP code below as an action in the light of this post, but it did not work with my field:
$node->expire = date('Y-m-d', strtotime("+[node:field-duration:field-value] days"));
return array("node" => $node);
- node:field-duration:field-value is an integer field of a taxonomy term
Any help would be appreciated. Thanks
$duration = $node->duration[LANGUAGE_NONE]['value']; $node->expire = date('Y-m-d', strtotime("+" . $duration . " days")); return array("node" => $node);
NPDOException: SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'expire' at row 1: UPDATE {node_expire} SET expire=:db_update_placeholder_0, expired=:db_update_placeholder_1, lastnotify=:db_update_placeholder_2 WHERE (nid = :db_condition_placeholder_0) ; Array ( [:db_update_placeholder_0] => -68400 [:db_update_placeholder_1] => 0 [:db_update_placeholder_2] => 0 [:db_condition_placeholder_0] => 110 ) in drupal_write_record() (line 7333 of /home/interjobcenter/public_html/drupal/includes/common.inc)
$duration = [node:field-duration:field-value]; $node->expire = date('Y-m-d', strtotime("+" . $duration . " days")); return array("node" => $node);