<p>When the config setting <a href="https://craftcms.com/docs/3.x/config/config-settings.html#useemailasusername" rel="nofollow noreferrer"><code>useEmailAsUsername</code></a> is set, I would expect updating a users' email address to also update the username field when saving the element. However, this does not occur unless you manually call <code>php craft utils/update-usernames</code>.</p>
<p>Should the username be updated when a users' email address is updated?</p>
<p>Is there a method to trigger this for the current user via a plugin or do I just need to update <code>username</code> alongside <code>email</code>?</p>
<p>Version: 3.5.15.1</p>
<p>Edit: This also prevents registration of a new user with the previous email address but does not indicate what the problem is clearly.</p>
<p><a href="https://i.sstatic.net/uz4dt.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/uz4dt.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2021-02-11T00:56:54.363Z
This feels like half-bug/half-feature request to me as I could see where people might want both behaviors. Can you make an issue for it? https://github.com/craftcms/cms/issues Going to go ahead and vote to close this here.
Brad Bell
CC BY-SA 4.0
2021-02-11T01:09:19.167Z
Thanks @BradBell, will do. As I was writing it I thought it might be more of a GitHub issue.
William Isted
<users><config>
Updating user email does not update username when useEmailAsUsername is set
# Updating user email does not update username when useEmailAsUsername is set

(Asked by: username_0 on 2021-02-08)

When the config setting [`useEmailAsUsername`](https://craftcms.com/docs/3.x/config/config-settings.html#useemailasusername) is set, I would expect updating a users' email address to also update the username field when saving the element. However, this does not occur unless you manually call `php craft utils/update-usernames`.

Should the username be updated when a users' email address is updated?

Is there a method to trigger this for the current user via a plugin or do I just need to update `username` alongside `email`?

Version: 3.5.15.1

Edit: This also prevents registration of a new user with the previous email address but does not indicate what the problem is clearly.

[![enter image description here](https://i.sstatic.net/uz4dt.png)](https://i.sstatic.net/uz4dt.png)

**Tags:** users, config

> **Comments:**
> **username_1**: This feels like half-bug/half-feature request to me as I could see where people might want both behaviors. Can you make an issue for it? https://github.com/craftcms/cms/issues Going to go ahead and vote to close this here.  
> **username_0**: Thanks @BradBell, will do. As I was writing it I thought it might be more of a GitHub issue.  

---

## 0 answers

