Assign anonymous node to user Id What I want to try and achieve.

An authenticated user creates a node of type 'listing' (this node obviously belongs to this user via his uid). On this node will be a link to create a new node of a different content type 'booking-request' (this link the author can't control).

Now an anonymous user can view this created 'listing' node and then they can click on the link and create a 'booking-request' node. So obviously the 'booking-request' node will belong to the anonymous user.

My question is. How can I assign this 'booking-request' node to the author of the 'listing' node after the anonymous user saves it?

Can I do this with a module or will this need custom php or both and how will I do this?
You can use Entity Reference Prepopulate.


  Allow prepopulating any Entity reference field via URL


In your booking-request set up an entity reference field pointing to user entities. Then, create a link in the listing node to booking-request node add form with the right parameter to prepopulate that entity reference field.

See README in the module:


  In order to pre-populate an entity reference field you have to supply
  the parameter in the URL.
  
  The structure is node/add/article?[field_ref]=[id]
  
  Where [field_ref] is the name of the entity reference field and [id]
  is the id of the entity being referenced.
  
  Examples: node/add/article?field_foo=1 node/add/page?field_bar=1,2,3