Custom PHP code to create a node with rules I am trying to create an Automatic Registration with rules. Basically when a new asset is created a rule will kick off and create a new registration node with custom PHP but the new node is not being created. I don't see any errors in the reports. Here is the code:

$node = new stdClass;
$node-&gt;type = 'asset_event';
$node-&gt;title = 'Automatic Registration';
$node-&gt;[field_first_name]['und'][0]['value'] = [site:current-user];
$node-&gt;[field_asset_event_type]['und'][0]['tid'] = 791;
$node-&gt;[field_asset_additional_informati]['und'][0]['value'] = 'Event created by automatic registration';
$node-&gt;[field_link_to_asset_id]['und'][0]['value'] = [node:field-link-to];
node_object_prepare($node);
node_save($node);


Thanks for any help.
In Rule:


Create a new entity
Of type Node
At the end of your action, the "Provided variables" section will give you the label of the entity created
Use that entity, already fetched, to set fields (with "Set a value") of that node.


Enjoy !