Problem/Motivation

When creating a new account from /admin/people/create and set the user name, it always takes the first part of the email, until save and edit the user then change the name to take a new name.

Steps to reproduce

- Install Drupal
- Install and enable the Email Registration module.
- Go to /admin/people/create
- Fill in the fields and change the user name.
- Submit the form.
- After submitting the form, the user name is not as it was filled before, it will be the first part of the email.

Proposed resolution

I suggest in email_registration_form_user_form_alter to give the user name default value rather than value, by replace
$form['account']['name']['#value'] = 'email_registration_' . user_password(); with
$form['account']['name']['#default_value'] = 'email_registration_' . user_password();

CommentFileSizeAuthor
#11 3276910-11.patch671 bytessourabhjain
#4 3276910-3.patch661 bytesqusai taha
#3 3276910-3.patch833 bytesqusai taha
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Qusai Taha created an issue. See original summary.

qusai taha’s picture

Status: Active » Needs review
StatusFileSize
new833 bytes

Patch to fix the issue on 8.x-1.1 version

qusai taha’s picture

StatusFileSize
new661 bytes
qusai taha’s picture

Title: Fix change the user name when creating a new account it always takes the first part of the email » Fix changing the user name when creating a new account. As it always takes the first part of the email
ericgsmith’s picture

Status: Needs review » Reviewed & tested by the community

Have reviewed and tested this patch and it fixes the issue.

greggles’s picture

Thanks for the wonderful bug report, patch, and review. This seems to apply to 8.x-1.x but not to 8.x-1.x-dev.

Could you test this same bug against the current 8.x-1.x-dev and see if the problem is still there? If not I will roll a new release to get the fix into more sites.

qusai taha’s picture

Hello @greggles
I tested the bug on 8.x-1.x-dev and the issue exists on it.

greggles’s picture

Status: Reviewed & tested by the community » Needs work

Hmm, then I think this needs to go back to needs work because the patch doesn't seem to apply.

sourabhjain’s picture

Assigned: Unassigned » sourabhjain

I am working on this issue.

sourabhjain’s picture

Assigned: sourabhjain » Unassigned
Status: Needs work » Needs review
StatusFileSize
new671 bytes

I have resolved the issue. Please review.

greggles’s picture

Status: Needs review » Fixed

I'm not sure why I had difficulty in #7. The patch in #3 is from the wrong base, maybe that was what I tested and caused the problem?

Anyway, I just merged this. Thanks again, all, for your help!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

andypost’s picture