Default avatar from Name & not from Username


(Binoj David) #1

Is there a way with which we can change the generation of default avatar from username to user’s full names?
Many of our users have numerical usernames or their usernames start with a certain character (like P, R).


(Dave McClure) #2

I don’t think there is any way to do that at this time.


(Binoj David) #3

Is there any way we could hack into it? Probably by forking the Discourse repo and merging whenever there is an update? Or can it be achieved by writing a plugin?


(Dave McClure) #4

Maintaining a long term fork is generally discouraged.

Probably you could do this as a plugin or by submitting a PR that adds this option as a Site Setting.

I would start with the latter as its probably easier and likely a pretty small change (though I could be wrong).

Whatever you learn in doing so will be helpful in developing it as a plugin if it’s not accepted into core for some reason.


(Binoj David) #5

Any idea/pointers where should I start looking to modify this behavior and add a setting?


(Dave McClure) #6

I would just start grepping the code base for “avatar” and see if you can find where the letter avatar is currently generated…

Then search for “SiteSetting” and see how other site settings are implemented.

If you get stuck, let us know and I can take a closer look.