How can I update webform_submission uid in the table, after which the anonymous user has registered? I'm a graphic design, and I just started using Drupal 7.

I have a form created with webform, which collects data entered by the user, after sending, the user is directed to the purchase page. The stages of the purchase is successful if both the user and logged in, whether the user is anonymous.

Here's my problem, from the control panel of Drupal 7 when I go to see the results of the webform, if the form has been sent by the user logged in, see the user's name, is so I know who did it then submitting the form. While it has been the anonymous user, in the results I see anonymous user even after the user has registered and recognized.

For clarity I describe what it does with this form, these are the steps that the user to fill out the form webform:

1) Fill out the form webform (in this form there two fields of the form "webform commerce")
2) after sending the form you will be directed during the cart / checkout, at this stage the user enters the email for the registration, if it is anonymous.
Everything works perfectly.

I noticed that the field in the table webform_submission uid inside the database remains at 0 even after the user has registered.

Browsing around the net in the blog / forum / drupal.org
I left this tutorials: example tutorial
so I'm starting to use hook_webform_submission_presave in a custom form.
So how do I fill the uid after the form has been sent?

This is the code:

            &lt;?php
/**
 * @file
 * Questo modulo server per collegare utente anonimo con il webform inviato.
 */
// hook per ottenere l'ID dell'utente che ha inviato il modulo webform
function mio_modulo_webform_submission_presave($node, &amp;$submission) {
  // Ottengo l'id dell'utente.
  //$user = user_load($submission-&gt;uid);
  global $user;

  $user-&gt;uid; 

} 
?&gt;


Sorry for my english
Thanks in advance for the help
It sounds like your webform has already been submitted by the time they reach checkout. So essentially, you may need to "Update" the submission with the new user ID.

Check out webform_submission_update:
http://drupalcontrib.org/api/drupal/contributions!webform!includes!webform.submissions.inc/function/webform_submission_update/7