Hi all
I'm trying to make a module that alters the registrationproces so the username is the same as the users email. To stop the namefield from showing up I inserted this into my custom modules
hook_form_alter
if($form_id == 'user_register') {
unset($form['account']['name']);
}
and the to avoid that the validation reports that the username is empty, I inserted this into hook_user
if($op == 'validate') {
$edit['name'] = $edit['mail'];
$account['name'] = $account['mail'];
}
this works, but it gives me the error below, which I think is wierd, because if I don't unset the namefield, and enter the same email in both email and name, this error doesnt occur.
user warning: Duplicate entry '' for key 2 query: INSERT INTO users (mail, pass, init, status, uid, created) VALUES ('fdasaaa@example.com', '09b0f27498e319464775226798ae52a0', 'fdasaaa@example.com', 1, 114, 1173891868)
Any help wil be greatly appreciated!!
Best,
/Johs.
Comments
bump
How did you go with this?
xweb
It's a sort of hack...
but I just kept both the name and validated them against eachother. I used the hook_user in one of my cutom modules. This is the code
Best,
/J.
A similar thread also Email
A similar thread also Email for username. at http://drupal.org/node/133038 -
Chris.