# Update quotes and mentions when username is changed

**URL:** https://meta.discourse.org/t/update-quotes-and-mentions-when-username-is-changed/39836
**Category:** Feature
**Created:** [February 19, 2016, 7:16am UTC](https://meta.discourse.org/t/update-quotes-and-mentions-when-username-is-changed/39836 "2016-02-19T07:16:30Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### Post date: [February 19, 2016, 7:16am UTC](https://meta.discourse.org/t/update-quotes-and-mentions-when-username-is-changed/39836/1 "2016-02-19T07:16:31Z")

</div>

A user recently asked me whether he could change his username on our 2 month old site.

He had been lurking for a while and then recently started posting.

When I tried to update it through the admin UI, the big scary warning made me pause:

 ![](https://global.discourse-cdn.com/meta/original/3X/0/9/09d949c3f94e26e012dcfbe7d1d1b98e3e09d480.png)

From looking through the new user list and seeing that many people are accepting the auto-generated name when they first sign up, I’m somewhat anticipating this to become a more frequent occurrence as each user starts to engage more and sees their username in ‘public’ for the first time when they post.

I second the proposal from this long ago topic:

Continuing the discussion from [What are the 'consequences' of changing your name?](https://meta.discourse.org/t/what-are-the-consequences-of-changing-your-name/424/39):

> [@Ajarn](#):
>
> If a name is changes it would be neat if all the @mentions would change to the new name. Would that be possible?

But also, how are people dealing with this now?

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [February 19, 2016, 7:25am UTC](https://meta.discourse.org/t/update-quotes-and-mentions-when-username-is-changed/39836/2 "2016-02-19T07:25:49Z")

</div>

I see this as being an insanely expensive database operation. Without knowing the exact structure, it is hard to say, but it would appear that one cannot simply query every post where a user was quoted efficiantly. Mentions might be easier, as they appear to be tracked already - you can view mentions on your profile - but if a user has been around a while, and mentioned a lot, that is a tremendous number of operations to go through and edit every single entry.

---

<div class="post-metadata">

### Author: ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### Post date: [February 19, 2016, 7:27am UTC](https://meta.discourse.org/t/update-quotes-and-mentions-when-username-is-changed/39836/3 "2016-02-19T07:27:56Z")

</div>

I’m surprised this doesn’t come up more, though. Or does it and I just am having trouble with search?

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [February 19, 2016, 7:32am UTC](https://meta.discourse.org/t/update-quotes-and-mentions-when-username-is-changed/39836/4 "2016-02-19T07:32:38Z")

</div>

> [@mcwumbly](#):
>
> I’m surprised this doesn’t come up more, though.

I’m not: I don’t think that many users sign up with a username and then decide to change it months later. From my experience with Discourse (and other sites), most people have a username they tend to use online, and thus don’t have many needs to change it.

I think many people also have no idea that it can be changed, and thus don’t try. Many sites do not allow username changes - financial sites, email sites, corporate sites - so that may have something to do with it as well.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [February 19, 2016, 7:33am UTC](https://meta.discourse.org/t/update-quotes-and-mentions-when-username-is-changed/39836/5 "2016-02-19T07:33:06Z")

</div>

It is a very tricky DB operation cause … when you rename

@foo to @bar… you don’t want to rename @foobar to @barbar nor do you want to touch `@bar` which may be in a code sample, so you would need to walk every post and integrated with the Markdown parser.

In short

A nightmare.

---

<div class="post-metadata">

### Author: ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### Post date: [February 19, 2016, 7:34am UTC](https://meta.discourse.org/t/update-quotes-and-mentions-when-username-is-changed/39836/6 "2016-02-19T07:34:59Z")

</div>

Didn’t we do this recently here for @meglio? Or am I mistaken?

**EDIT** in my current case, there are just a few quotes that are “broken”, and even that is not so bad. I’m not sure I care that much and it seems like a reasonable compromise to just let the references dangle.

---

<div class="post-metadata">

### Author: ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### Post date: [February 19, 2016, 8:04am UTC](https://meta.discourse.org/t/update-quotes-and-mentions-when-username-is-changed/39836/7 "2016-02-19T08:04:26Z")

</div>

I think another thing that is particular about my use case is that its a **login-required** forum.

So at sign-up time, people have not had a chance to lurk and see what the social norms are for user names on the site yet.

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [February 19, 2016, 10:45am UTC](https://meta.discourse.org/t/update-quotes-and-mentions-when-username-is-changed/39836/8 "2016-02-19T10:45:41Z")

</div>

Do we really need to update old quotes and mentions? We could use a redirect.

If someone clicks on `@foo` we could show the profile of `@bar` and display a hint on the user’s profile (“previously known as foo”).

The old username should still be reserved. The fact that someone can reuse the username “foo” after it was renamed to “bar” is bugging me anyway.

Of course, if a user gets renamed that doesn’t have any quotes or mentions (do we track those numbers?) we could do a simple rename without the redirect.

---

<div class="post-metadata">

### Author: ![ccdw](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ccdw/32/51564_2.png) [@ccdw](https://meta.discourse.org/u/ccdw)
#### Post date: [February 19, 2016, 11:45am UTC](https://meta.discourse.org/t/update-quotes-and-mentions-when-username-is-changed/39836/9 "2016-02-19T11:45:57Z")

</div>

I appreciate there’s a big legacy issue to consider - but notwithstanding this, perhaps _in future_ you could consider normalising this and storing only the user’s ID, and then resolving the current username every time the ID surfaces in the UX/email digests etc? That’s assuming that the organisation operating the forum doesn’t have absolute retention policies in place to ensure non repudiation.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [February 19, 2016, 12:53pm UTC](https://meta.discourse.org/t/update-quotes-and-mentions-when-username-is-changed/39836/10 "2016-02-19T12:53:44Z")

</div>

I always wanted our users routes to be `/users/ID/etc` this would be a non issue

But… changing this now would be mega painful

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [February 19, 2016, 12:58pm UTC](https://meta.discourse.org/t/update-quotes-and-mentions-when-username-is-changed/39836/11 "2016-02-19T12:58:25Z")

</div>

> [@sam](#):
>
> But… changing this now would be mega painful

So would changing it later 😉

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [February 19, 2016, 1:02pm UTC](https://meta.discourse.org/t/update-quotes-and-mentions-when-username-is-changed/39836/12 "2016-02-19T13:02:21Z")

</div>

Well the other issue is that I am the only one that really wants the scheme changed, @eviltrout finds ids in URLs very ugly. In practice renaming users is really super rare, but there is something to be said about the extra flexibility you get with ids, especially if we ever allow Chinese usernames etc.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [February 19, 2016, 1:10pm UTC](https://meta.discourse.org/t/update-quotes-and-mentions-when-username-is-changed/39836/13 "2016-02-19T13:10:40Z")

</div>

Yeah, no doubt, my subtle point was, if it is a direction Discourse feels solves a problem (or multiple problems), that waiting especially on this one, will cause even more pain versus biting the bullet sooner. Yes, it is going to hurt regardless, but what is certain, is it will hurt even a bit more, the more it is pushed back (but you know this).

I’m impartial on the whole idea. I see where everyone is coming from with renaming users, but I fear even aliases are not 100%, what happens when User A renames themselves to User B, and then User C renames themselves to User A… now what?

Or if User A renames themselves to User B and then a new user signs up claiming User A’s original username.

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [February 19, 2016, 1:37pm UTC](https://meta.discourse.org/t/update-quotes-and-mentions-when-username-is-changed/39836/14 "2016-02-19T13:37:23Z")

</div>

In my opinion, renaming a user shouldn’t free up that username.

---

<div class="post-metadata">

### Author: ![ccdw](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ccdw/32/51564_2.png) [@ccdw](https://meta.discourse.org/u/ccdw)
#### Post date: [February 19, 2016, 1:51pm UTC](https://meta.discourse.org/t/update-quotes-and-mentions-when-username-is-changed/39836/15 "2016-02-19T13:51:32Z")

</div>

> [@gerhard](#):
>
> In my opinion, renaming a user shouldn’t free up that username.

Agreed, and in some use cases, it would probably be illegal to do so.

> [@ccdw](#):
>
> That’s assuming that the organisation operating the forum doesn’t have absolute retention policies in place to ensure non repudiation.

And if the name was changeable, and I believe there are many reasons why this might be necessary, then a **previously known as** list should be maintained to support non repudiation.

---

<div class="post-metadata">

### Author: ![Blaisorblade](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blaisorblade/32/107357_2.png) [@Blaisorblade](https://meta.discourse.org/u/Blaisorblade)
#### Post date: [February 19, 2016, 3:47pm UTC](https://meta.discourse.org/t/update-quotes-and-mentions-when-username-is-changed/39836/16 "2016-02-19T15:47:00Z")

</div>

> [@sam](#):
>
> Well the other issue is that I am the only one that really wants the scheme changed, @eviltrout finds ids in URLs very ugly. In practice renaming users is really super rare, but there is something to be said about the extra flexibility you get with ids, especially if we ever allow Chinese usernames etc.

Don’t you do that already? Sometimes? I mean, I can share a link to this thread as `https://meta.discourse.org/t/update-quotes-and-mentions-when-username-is-changed/39836?u=blaisorblade` but also `https://meta.discourse.org/t/foo-bar/39836?u=blaisorblade` will work. That is, URLs contain a name with the role of an auto-generated comment for a question, and the actual question ID. Do the same for usernames.

Personally, I’ve already been annoyed by the issue on StackExchange, which is indistinguishable in these technical regards (given the common heritage) — username changes are possible and break mentions, and URLs mix IDs and comments so a solution would be possible by doing it more.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [February 19, 2016, 5:34pm UTC](https://meta.discourse.org/t/update-quotes-and-mentions-when-username-is-changed/39836/17 "2016-02-19T17:34:22Z")

</div>

Just a reminder that users can change their username at will for 3 days after their account is created. See the site setting `username change period`.

---

<div class="post-metadata">

### Author: ![anon61128213](https://avatars.discourse-cdn.com/v4/letter/a/eb9ed0/32.png) [@anon61128213](https://meta.discourse.org/u/anon61128213)
#### Post date: [July 6, 2017, 4:18pm UTC](https://meta.discourse.org/t/update-quotes-and-mentions-when-username-is-changed/39836/18 "2017-07-06T16:18:14Z")

</div>

> [@gerhard](#):
>
> Do we really need to update old quotes and mentions? We could use a redirect.
> 
> If someone clicks on @foo we could show the profile of @bar and display a hint on the user’s profile (“previously known as foo”).
> 
> The old username should still be reserved. The fact that someone can reuse the username “foo” after it was renamed to “bar” is bugging me anyway.

Is there any way to implement this already? I’d really like to try this method and add a little “a” into my username to indicate my gender-transition.  
In the Fairphone Forum I have 4.5k posts and was probably mentioned and quoted a similar number of times. I don’t think editing all posts mentioning/quoting me would be feasible and also I don’t mind my old name still being displayed in old posts. So a redirect would really be perfect.

How could this be done if at all?

---

<div class="post-metadata">

### Author: ![JagWaugh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagwaugh/32/69335_2.png) [@JagWaugh](https://meta.discourse.org/u/JagWaugh)
#### Post date: [July 6, 2017, 4:26pm UTC](https://meta.discourse.org/t/update-quotes-and-mentions-when-username-is-changed/39836/19 "2017-07-06T16:26:24Z")

</div>

Paul(a)

Have a look [here](https://meta.discourse.org/t/ability-to-merge-users/9220/51). This would allow you to replace @Paul with @Paula, but you’ll have trouble with replacing Paul with Paula (as you’ll end up with “Pope Paula”, “Peter, Paula and Mary” etc.

---

<div class="post-metadata">

### Author: ![anon61128213](https://avatars.discourse-cdn.com/v4/letter/a/eb9ed0/32.png) [@anon61128213](https://meta.discourse.org/u/anon61128213)
#### Post date: [July 6, 2017, 6:07pm UTC](https://meta.discourse.org/t/update-quotes-and-mentions-when-username-is-changed/39836/20 "2017-07-06T18:07:55Z")

</div>

Thanks for that suggestion.  
So I’d create a new user account, change ownership of all posts to the new user and change all references (which shouldn’t be a problem with the usernames paul(a)kreuzer, but if someone answered things like “Hey Paul, …” that would stay untouched)?  
I’m not really sure what steps 2 and 4 do.

Also:

> [@JagWaugh](#):
>
> The above procedure will probably mess up your user statistics table.

This would be a problem.

PS:  
What if I just changed my username (paulkreuzer → paulakreuzer) and create a new user with the old username (paulkreuzer)? Would quotes and mentions then show that new user?  
Then I could enter a redirection into that new user’s description and maybe it’s somehow possible to disallow mentioning that user in the future?

[Next page](https://meta.discourse.org/t/update-quotes-and-mentions-when-username-is-changed/39836.md?page=2)
