how do i make diffrent registration form in drupal?

2.9k views Asked by At

Is there a module that can make different registration forms for different roles during sign up? (ex. each Editor,Main User,Sub User role have different form)

3

There are 3 answers

4
jpstrikesback On BEST ANSWER

There is :)

http://drupal.org/project/autoassignrole

to assign by path you will also need Content Profile:

http://drupal.org/project/content_profile

check out this tutorial on how to pull it off:

http://www.web-a-team.com/blog-post/user-registration-more-one-role

0
Triss On

Here is some idea how to solve your question in drupal 7(I think it should work in drupal 6 also). However its not safe since anyone can just change the role they have:

function my_module_form_user_register_form_alter(&$form, &$form_state, $form_id) {

    $company_role = $form_state['build_info']['args'][0];

    $form['account']['company_role'] = array(
        '#type'         => 'select',
        '#title'        => t('Company role'),
        '#options'      => drupal_map_assoc(array('editor','main user','Sub User')),
        '#description'  => t('Please select your company role'),
        "#empty_option" =>t('- Select -'),
        '#weight'       => -11,  // Add the select box above username that have weight -10

    );

    switch (strtolower($company_role)) {
        case 'editor':
            // add extra fields for editor
            $form['account']['company_role']['#default_value'] = $company_role;
            break;
        case 'main user':
            // add extra fields for main
            $form['account']['company_role']['#default_value'] = $company_role;
        case 'sub user';
            // add extra fields for 'Sub User'
            $form['account']['company_role']['#default_value'] = $company_role;
            break;
        default:
            $form['account']['company_role']['#empty_option'] = t('- Select -');
            $company_role = null;// error handling or default case
    }

}

If you for example have LDAP in your company you could instead get this information from LDAP(https://www.drupal.org/node/1053748). Then you can be more sure about the role is chosen correctly.

1
Ashish Madkaikar On

Here's what you should do

  1. start with install profile2-7.x-1.2.tar.gz.
  2. entity-7.x-1.0-rc3.tar.gz once you have profile2 installed -->
  3. enable --> click on configure - (Here you see your profile types -add as many as you want).

when you add a new one or modify the existing one "Main" make sure you check "Provide a separate page for editing profiles." 4. Now to have different registration, login and password change pages install and enable profile2_regpath-7.x-1.9.tar.gz Now visit the profile Types Page again here you should see "UNIQUE REGISTRATION PATH" .. rest is easy ..