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.

Javascript? PHP? I'm open to suggestions.

Comments

rHOnDO’s picture

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.

rHOnDO

"I used to be open minded, but my brains kept falling out."

canajun’s picture

an association. There are no anonymous users - registered or not.

incrn8’s picture

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

______________________________________________________________________________________________________
mybesinformatik.com - Drupal website development

panis’s picture

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:

http://www.hyrme.com/taxonomy/term/8

sign’s picture

http://sotak.co.uk/custom-registration-form-drupal

__________________________________ ____ ___ __ _ .. .. .
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

http://sotak.co.uk

suro.solutions’s picture

I can do it in what ever way you want to. This can be done using tpl or by building drupal forms. Contact me via my contact form.

sign’s picture

This is closed as you can see, the module is already used.

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

http://sotak.co.uk

canajun’s picture

Yes, thanks to sign, this request has been fullfiiled. Good work!

prateek’s picture