The Third Bear

Just Right.

Adding avatars for your Trac users

egj trac , opensource

I've released a new BSD-licensed Trac plugin, UserPicturesPlugin.   It displays user-specific icons wherever users are referenced in a typical Trac installation: the timeline, ticket reporters and owners, comments, reports and queries, search results, wiki history, source/browser/changeset views, and attachments.

Trac UserPictures ticket
Trac UserPictures file
Trac UserPictures query
Trac UserPictures timeline

Credit for the idea and most of the Genshi transformations is due to Michael Bayer -- this plugin is basically a rearranging of his "tracvatar" plugin's code with more configurability, a few additional stream filters, and some style tweaks for better Trac 1.0 compatibility.

The plugin consumes a configurable "pictures_provider" backend.  Two of these backends are provided in the distribution.  UserPicturesGravatarProvider tries to find an icon for every user at gravatar.com using the user's email address.  UserPicturesUserManagerProvider relies on Catalin Balan's UserManager plugin to provide user icons within the Trac install itself.  Patches or requests for additional provider backends are very welcome.

The plugin was developed against Trac 1.0-beta1; while it will probably work with older versions, it may not look as nice -- the plugin uses pretty specific Genshi transformations to insert the icons, so it's very dependent on Trac's HTML output.  If you want to use the UserManager provider, note that several patches are required to make UserManager work well with Trac 1.0-beta1.  You can find a patched copy of UserManager at https://github.com/ejucovy/trac-UserManagerPlugin (the most recent two commits on https://github.com/ejucovy/trac-UserManagerPlugin/commits/master provide the patches needed against the canonical UserManager source)