I want integrate Webfoem and registration user module.so , When a user fill a webform, some fields in that webform put in user table , and he/she insert in user list in my site. and I should active it our delete from users.

I have multiple Webform for registrations, and I want for each form change user role.

4 Answers 4


webform module in Drupal 6 implements a number of hooks upon submission.
One of which is hook_webform_submission_insert($node, $submission). This hook is invoked when a form (webform) is submitted.

$node is node object that holds webform, $submission hold data submitted via form to be inserted into database.

You can implement this hook to get submission data and then process manually and create a user using user_save()

function custom_module_webform_submission_insert($node, $submission){
    $user = array(
       'name' => $submission['user_name'],
       'mail' => $submission['user_mail'],
  • I don't know PHP code and don't know how to use this code!;) help me,Please Jul 18, 2011 at 18:13
  • 1
    You will have to create a custom module just creating two file [module_name].info and [module_name].module enclosed in a directory name similarly as those files [module_name]. See the guide (drupal.org/node/206753). If you still face any problem let me know with your email address I will prepare one for you and send it. Jul 18, 2011 at 20:24
  • Which Drupal version you are expecting? Jul 21, 2011 at 0:26
  • I use Drupal 6.22 Jul 21, 2011 at 7:33

There are two contributed modules that may provide what is needed (quotes included are from their project pages):

  • Webform register:

    ... adds a Webform component that collects user registration details and creates a new account. This is useful when you only want authenticated users to submit webforms, but you do not want to create an extra hurdle for people before they fill out your webform.

    Webform Register can help you keep the flexibility of Webform, while reducing duplicate entry for your visitors. Because the user registration page can be extended through Drupal's built-in user profile fields or with the help of Content Profile, the Webform Registration can help you collect user-specific, oft-repeated information such as Name, Address and Organization information and store it in a profile entry for each visitor. Meanwhile, information that's only pertinent to the individual webform, such as survey data or preferences for a single event, are collected by standard Webform behavior.

  • Webform Registration:

    ... born from the need to allow visitors that came to the site to fill out a sweepstakes from which needed to not only submit values to Eloqua, using the eloqua module, but also create a new user.

    At the time the Webform register module did not provide enough flexibility for what we needed to do. Which was have many different field names (used for eloqua mapping) and still keep track of which ones held the values for email, username and password.

    How is this module different from Webform register:

    • Maximum webform integration and flexibility
    • You can add and fully customize every field that will be used for registration.
    • If you are in a hurry, just add en email field and this module will handle the rest via a very user friendly and intuitive interface.
    • Only the email field (webform component) is required, all the other components can be either generated by this module or omitted depending on your needs.
    • Optionally you can specify all the labels and descriptions for all five fields (components): email, username, password, password confirmation and email confirmation

@Shuab Nawaz :

Note that hook_webform_submission_insert() is called after a submission has been saved to the database, as explained in webform.api.php file.

If one wants to modify the submission before the data has been saved in the database, hook_webform_submission_presave() should be used.


Was looking for this to mimic the invite or registration codes which are heavy and need complex configuration. Finally ended up with this article and implemented it.

For assigning a role create separate webform for each role or create a select list having role as items.

Not tested but you can also try entityform which supports drupal fields and that means you can attach any field including role though you need custom module

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.