Request: Custom Avatar Source


(Janek Ostendorf) #1

Hey Ruby magicians,

as I’m not able to write a single line of Ruby (and not willing to learn for what I need), I’m coming to you with my request.

I’m running Discourse for a Minecraft server, and as we only know eachother from the skin in-game, I’d like to bring that skin into the forums as well.
My idea is to allow the player to set his Minecraft username in the profile (e.g. by custom user field or by plugin). The player will then be able to set the avatar to the head of his skin.

(This design is what i though of)

The idea is to allow fetching a custom avatar from a defined URL pattern set in the admin panel, like this:
http://i.fishbans.com/helm/<minecraft name>/<size>.png

I’d need to use custom user fields in the pattern as well, though, as the Minecraft name will be stored in a custom user field rather than being the Discourse user name.

Optional: Performing checks to see if the custom avatar can be used on the user. E.g. the user does not have a Minecraft name set, so he can’t use the custom avatar source (as it only would throw an error).


Please let me know, if somebody is willing to write a plugin for this. Thanks!


(Michael Downey) #2

Cool idea, but perhaps it would be more useful if it were flexible to allow an admin to specify the URL pattern of their avatar server? That way it could be used by various different sources.


(Janek Ostendorf) #3

Sounds like a great idea, but we’d need a way to use custom user fields in the URL pattern. I’ll change the first post accordingly.


(Sam Saffron) #4

I recall @vikhyat playing with this area, perhaps he can help you.


(Vikhyat Korrapati) #5

The solution we are currently using involves adding an avatar_template column to the users table:

https://github.com/hummingbird-me/discourse/commit/85d0fdbcab03250e760dccb48ed554d4b6af792e

After that these files in our plugin cause the avatar_template to be used instead of uploaded_avatar_id:


(Cedric Meirsman) #6

How do we need to install this option?