Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
391 views
in Plugins by

I want it to be easier for users to differentiate other users, but not require anyone to upload their own avatar. Does someone know of a way to integrate something like Identicons or robohash into q2a, based on their user ID or something? Perhaps a plugin already exists, but I couldn't see one.

1 Answer

+2 votes
by
selected by
 
Best answer

Gravatar support is included by default. Their default icons are similar to Identicons.

You could also integrate Robohash by using an advanced theme and overriding the avatar() function. Get the username and output an image with that, eg https://robohash.org/Scott.png

Probably better to use a hash of the name just to be safe. Something along the lines of

public function avatar($item, $class, $prefix=null)
{
    $hash = sha1($item['who']['data']);
    $item['avatar'] = '<img src="https://robohash.org/'.$hash.'.png">';

    parent::avatar($item, $class, $prefix);
}

...