Adding 'anonymous*' to reserved_usernames blocks creation of 'AnonymousXX' name structure in Anonymous mode

Continuing the discussion from How to anonymise a single post?:

I tried this just now, and the anonymous user created for the user was 20-character set of seemingly random alphanumeric characters beginning with cb426… I had expected it to be in the format “anonymous99” or “anonymous100”.

Is this a bug or am I doing something the wrong way?

1 Like

I have just impersonated a test user and then entered anonymous mode and the name generated is in the anonymousNN style.

Is this something you can replicate on more than one account?

1 Like

Yes, it’s the same (albeit a different random username) for another user I tried it with.

I’m using 2.9.0.beta10 (0c38757250).


I wonder whether I have anonymous mode enabled for TL1+ and was trying to impersonate/anonymise a TL0 user. I’ll check later.

1 Like

I made sure that allow anonymous posting was set, that anonymous posting min trust level was 0, created a brand new user, logged in as that user (not impersonating), entered anonymous mode, and the username created was…


So it’s something about anonymising on its own, rather than just when impersonating. I’ll change the title of this topic from Anonymous user created when impersonating user doesn’t begin with “anonymous” to something more accurate.

P.S. still 2.9.0.beta10 (0c38757250)

Do you have a lot of anonymous users?

I think this was fixed at the time, but there may have been a regression?

1 Like

Just over a dozen, plus four of these 20-random-character users in the last fortnight or so.

The person it cropped up for had created a real username “Anonymous20” when the next anonymised name would have been “anonymous20” (I can’t remember the actual number).

(I then renamed him and added “anonymous” to the list of words you can’t use in a username.)

Could that be relevant?

1 Like

This sounds promising. Let me check on my test site. :+1:

1 Like

Cheers. Looking at it, to reserved usernames I added anonymous and anonymous*

I’ve just removed those two additions, and it all works fine again! Thanks for pointing me to the old topic which made me think of this.

It would still be good to prevent users from creating accounts with the word “anonymous” in it, but still have anonymous mode work properly. I guess this is still a bug.

1 Like

It’s the anonymous* that’s the culprit:


The user_name_suggester checks the reserved names before allocating one, so adding that will be what’s gumming it up: :+1:

1 Like

Thanks for clarifying this.

Maybe it would be better for Discourse to check reserved usernames but ignore any prohibition on the word “anonymous” when creating an anonymous user.

1 Like