General developer forum

Pluggable user avatars

 
Picture of Charles Fulton
Pluggable user avatars
Core developersPlugin developersTesters

Had an idea here and wanted to hear what others thought.

I recently completed a project at my institution to sync user ID photos from an external database. This involved a local plugin to import the photos into the filesystem and a core hack to tell Moodle to prioritize these photos over locally-uploaded images and Gravatar integration.

I think the current avatar system could be improved. The user avatar system relies on user uploads, with a hard-coded fallback to Gravatar (if available) when there's no user upload. It's not possible to change the order of preference, nor is it possible to add other integrations without said core-hacking. Making user avatars a pluggable system (with direct upload and Gravatar as included plugins) would make new integrations such as Libravatar (MDL-29584) or home-grown solutions simple and straightforward.

This mockup shows a system with three potential sources of images:

Pluggable list of user avatar repositories

Beyond image sourcing, I could see this improvement leading toward support for larger image sizes and other enhancements.

Thanks,

Charles

 
Average of ratings: Useful (1)
Picture of Kevin Wiliarty
Re: Pluggable user avatars
Core developersParticularly helpful MoodlersPlugin developersTesters
This is a brilliant idea. Like you, we have found ourselves hacking Moodle so that we can use our institutional photos. I would be much happier writing a plugin than hacking core.
 
Average of ratings: -
Picture of Richard Oelmann
Re: Pluggable user avatars
Core developersParticularly helpful MoodlersPlugin developersTesters

Sounds like a great idea - can I suggest you make a Moodle Tracker for an improvement request and possibly then add screenshots and maybe submit the code you already have as a starting point.

 
Average of ratings: -
Picture of Michael Aherne
Re: Pluggable user avatars
Core developersParticularly helpful MoodlersPlugin developers

Sounds like a really good idea to me too, but I wonder how the fallback process would work? You'd presumbaly need each plugin to be able to (quickly) determine whether it had an image for a user, but not all services will be able to do that - if I remember correctly Moodle can't check whether there is an image in Gravatar for a particular email address, which is why it is implemented the way it is.

Even without the fallback mechanism it would still be an excellent feature if the student was able to choose their preferred image from multiple available sources.


 
Average of ratings: -