Populating a node reference field using PHP in Rules
This should actually be pretty simple:


Create your rule for the event "A node has been flagged, under "NAME OF YOUR FLAG" and name your rule
Add an action of "Add new content" and click "Next"
Choose what you want the auto-created content's title to be (w/ or w/out tokens) and select what content type you want created and click "Save"
Add another action of "Populate a field", for the arguments configurations choose "new content type of CONTENT TYPE YOU CREATED" and for field, choose your node reference field and click "Continue"
Again on arguments change to "new content type of CONTENT TYPE YOU CREATED"
Open the fieldset titled: "Advanced: Specify the fields value with PHP code" and enter:


return array(0 =&gt; array('nid' =&gt; $node-&gt;field_NAMEOFYOURFIELD[0]['nid']));

Note: You can find the field names by going to admin/content/types and click "Manage Fields" on the content type you want OR you can do a print_r($node); on a node of that content type to see the node object structure

Now when you view your rule, you should see something like:



and whenever you use that flag, a new node will be created having the same reference as the node you flagged.