Hi,
I found that this module is conflicting with Email Registration module https://drupal.org/node/2016671, after enabling this module, the new username will all become something like email_registration_JRABWYc2oY . Bug with this Module or Email Registration ? Thanks

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sense-design’s picture

Kionn’s picture

An alternative solution may be to move the code from user_insert into user_presave. Something like this:

function email_registration_user_presave(&$edit, $account, $category) {
  if ($account->is_new) {
    $names = module_invoke_all('email_registration_name', $edit, $account);
    // Remove any empty entries.
    $names = array_filter($names);
    if (empty($names)) {
      // Strip off everything after the @ sign.
      $new_name = preg_replace('/@.*$/', '', $edit['mail']);
    }
    else {
      // One would expect a single implementation of the hook, but if there
      // are multiples out there use the last one.
      $new_name = array_pop($names);
    }
    // Ensure whatever name we have is unique.
    $new_name = email_registration_unique_username($new_name, $account->uid);
    // we don't actually update the user table directly,
    // instead we let the user revisions module take care of this
    $edit['name'] = $new_name;
  }
}
fnikola’s picture

Confirming patch in comment #1 works.

skylord’s picture

Version: 7.x-1.6 » 7.x-1.7
Status: Active » Needs review
FileSize
573 bytes

For last version.

attiks’s picture

Can you reroll the patch

roland.molnar’s picture

RickJ’s picture

Status: Needs review » Closed (won't fix)

Closing, as the consensus appears to be that it's best fixed in email_registration.