I've combined several issues together into one patch:

  • #351511: Switch to validation approach + hide username on edit page if username=email
    • This patch changes the approach of the module. Instead of manipulating the database directly in hook_user() for the insert and update cases, this patch feeds the new username into the form on validate, and let's Drupal's native handling take care of the rest. This allows greater inter-operability in the workflow with other modules.
    • If the username is set to be equal to the email address per the flag on the admin page, then when users are allowed to edit their own username they should not see a separate username field. This patch checks for this in hook_form_alter() in the user_edit case, which breaks immediately if the flag is false but carries through to user_register case if the flag is true.
    • And finally, I needed the super-admin (uid=1) to be able to pick the username without any interference from this module, so I just put in a quick check for that. Perhaps that can be made more customizable in the future, if you want the admin's username to remain the same as well?
  • #241909: No t() on login form
    • A fairly simple and routine correction for missing t() fucntions.
  • #345399: Broken username when mail is missing from edit form...

There is slight change in setting up the module now:

  • One less obligation: This module's main page currently notes: "You will probably want to change the welcome e-mail (Administer -> User Management -> User Settings) and replace instances of the token !username with !mailto." This is no longer the case. This patch allows for normal "welcome!" emails from Drupal without any necessary changes.
  • One new obligation: You must go to Administer -> User Management -> Access Control and allow authenticated users to change their own username. Otherwise, you'll get a validation error when users try to change their email address.

This is just for 5.x-1.x-dev release. I sadly don't have time to make a patch for 6.x.

CommentFileSizeAuthor
#1 master.patch3.77 KBsbandyopadhyay
master.patch3.92 KBsbandyopadhyay

Comments

sbandyopadhyay’s picture

StatusFileSize
new3.77 KB

Err... sorry, use this instead:

Christopher Herberte’s picture

Status: Needs review » Reviewed & tested by the community

Thanks sbandyopadhyay, RTBC for 5.x
To port to 6.x

Christopher Herberte’s picture

patch applied to head, leaving the issue open as it needs testing.

Christopher Herberte’s picture

Status: Reviewed & tested by the community » Closed (works as designed)