Hi.

Is is possible to auto-generate usernames to be exactly as the e-mail addresses?

Thank you

Comments

halmsx’s picture

what are you trying to achieve with this?

mrbrookman’s picture

Status: Active » Closed (fixed)

You can sync your username with the mail-address using the module rules.

BrianLP’s picture

Could someone point me to more info on that? I couldn't find out how this can be done with rules.

Elin Yordanov’s picture

  1. Go to: admin/config/workflow/rules
  2. Add new rule
    • Give it a name, like 'Sync username with email'
    • React on event: 'After saving a new user account'
    • Save
  3. On the editing reaction rule page:
    • Under actions, click '+ Add action'
    • Select the action to add: 'Set a data value'
    • Data selector: 'account:name'
    • Continue
    • Value: '[account:mail]' OR click 'Switch to data selection' and select 'account:mail'
    • Save
  4. Optionally: Under events, click '+ Add event'
    • React on event: 'After updating an existing user account'
    • Save
Neli’s picture

Very viable solution, but for me it's not working.
I the error:
Integrity constraint violation: 1062 Duplicate entry '92-5' for key 'PRIMARY': INSERT INTO {users_roles}

Does anybody else get this error while using Email Registration + Rule mentioned here?

Stan Turyn’s picture

#4 works very well for me; thank you, pc-wurm