Search form

Custom Registration Form

I need a modification to the create account script that will initially show only two text fields.. firstname and lastname. The new user will enter these and click 'continue', which will start the usual registration form, and fill in the username automatically with 'firstname.lastname' -- it would be best if the username field was set to readonly, so the new user couldn't change the generated username.

It is also necessary that the initial two text fields would set the appropriate fields in the profile page, and not appear for registered users.

It would be best if this could be done via themes or modules, and not to core files, so updates would not affect the function.

Comments

It would be interesting to know what the purpose of the site is. Many users would balk at having their username be firstname.lastname instead of something anonymouns ... like 'rHOnDO' ... especially if they didn't realize that it was going to be their username until after they'd entered the information.

This is possible (theoretically) as there is at least one module that inserts itself before the registration page. Take a look at the Role Signup module. If you can hack some PHP, you should be able to modify the code so that it will use the "name" form instead of the role select menu. The only trick is getting those two fields to be put in as the username, but using the $_SESSION variable might work.
______________________________________________________________________________________________________mybesinformatik.com - Drupal website development

1) add firstname and last name to user profile and make them mandatory on registration.
2) use custom module and form-alter hook to hide the "username" field and fill it with a unique but temporary identifier.
Then:
a) you could use some inline javascript to grab the firstname and last from the form and populate the username field automatically before the form gets submitted.
b) Or in your custom module hook_user() reset the username per your needs on an insert or update op.
3) also use your custom module form alter hook to make the username "unmodifiable" on the profile edit form.

I did something similar to force a user to login and create useraccount with their email addresses - you can download the code here:

__________________________________ ____ ___ __ _ .. .. .
Give a man a fish, and you'll feed him for a day. Teach a man to fish, and he'll buy a funny hat. Talk to a hungry man about fish, and you're a consultant.
- Scott Adams

I am just currious how will you achieve this functionality with just tpl files?

__________________________________ ____ ___ __ _ .. .. .
Give a man a fish, and you'll feed him for a day. Teach a man to fish, and he'll buy a funny hat. Talk to a hungry man about fish, and you're a consultant.
- Scott Adams