Search code examples
drupaldrupal-webform

Programmatically change the submitter user in the webform module


I automatically create users for visitors that submit my webforms as per http://www.mikewagan.net/2010/10/drupal-create-user-accounts-through-the-webform-module/

This all works fine, with one little problem: The Webform submission data should be changed as to represent the correct submitter (my newly created user), currently it is tied to the unauthenticated user.

I tried $form['details']['uid']['#value'] = $account->uid; in the Additional Processing field, but that does not seem to work.

Which part of Webform's submission data do i have to massage to make this happen?


Solution

  • My suggestion is to perform a hook_nodeapi , and edit the submitter inside the node right before it is created.

    check the states nodeapi gives you here:

    http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_nodeapi/6