UPDATED 24/11/2007
I have stumbled upon a request (Custom Registration Form) for creating a module, which will use first name and last name to generate a username.
The request was quite simple. I am thinking now about extending it, and creating something like a module which will use any profile field, and it will let you configure from which profile fields usernames will be generated.
Now it will take only two profile fields (you can select them in the settings of the module under administer>user>name registration settings).
When user registers, it hides username from user_register form and it puts your 2 fields on top of the form.
After hitting submit, user name is generated from fields, replacing spaces with underscores and adding a separator '.' between first and last field.
So for example:
if someone registers with first name: Pamela
and last name: Anderson
the username will be Pamela.Anderson
You can change some error messages as well in settings.
Anyways, I want to improve this module, so it will let you define how to generate the username.
Let me know how you like it, and if you think this should be in Drupal repository as a module.
This module was initialy sponsored by Bob Babcock ;)
| Attachment | Size |
|---|---|
| name_registration.tar.gz | 2.31 KB |
Delicious
Technorati
Comments
Additional Functionalities
One other suggestion would be to incorporate the hook as suggested on drupal to make the username "readonly" or "hidden" for the user once registered.. not much point in going to all this trouble, only to have it undone by the user once registered!
Little update
You can now disallow users to edit this field in my account area. Fields will become disabled, therefore users can't change the value.
Duplication
How are you handling the case in which a user with the name Pamela.Anderson already exists?
Post new comment