Commit cfe229a8 authored by Jon Pugh's avatar Jon Pugh Committed by andypost

Issue #678434 by Jon Pugh, hadsie, mikeryan: Fixed Don't generate username if...

Issue #678434 by Jon Pugh, hadsie, mikeryan: Fixed Don't generate username if the account->user is already set.
parent c76ace39
......@@ -9,6 +9,11 @@
* Implements hook_user_insert().
*/
function email_registration_user_insert(&$edit, &$account, $category = NULL) {
// Don't create a new username if one is already set.
if (!empty($account->name) && strpos($account->name, 'email_registration_') !== 0) {
return;
}
// Other modules may implement hook_email_registration_name($edit, $account)
// to generate a username (return a string to be used as the username, NULL
// to have email_registration generate it).
......@@ -59,7 +64,7 @@ function email_registration_user_insert(&$edit, &$account, $category = NULL) {
*/
function email_registration_form_user_register_form_alter(&$form, &$form_state, $form_id) {
$form['account']['name']['#type'] = 'hidden';
$form['account']['name']['#value'] = user_password();
$form['account']['name']['#value'] = 'email_registration_' . user_password();
$form['account']['mail']['#title'] = t('E-mail');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment