Create referral url for user and add UID to hidden field when url used I need to create referral url for authenticated user. This url should be url for webform, and it should include user UID.

When user shares this url and someone uses it to fill webform it should set UID to the hidden field in webform - so admin can see whose referral url was used.

How to create this url?
How to set referred user UID to hidden field?

Can someone point me to the right direction where to start implementing this?
If I understand the question correctly, you want something like:

h(tt)p://www.example.com/register?uid=25

where register is a webform that the incoming person can access?


I would start by creating the form at the correct location with all of the elements you want
use some javascript (or form override) to hide the relevant form item that will hold the uid
override the form submit function to assign the uid in the url to the hidden element


take a look at the documenation for webform, and the Drupal Form API for specifics.