Avatar Identicon by Iversia

Avatar Identicon by Iversia 1.2.2

No permission to download
Thanks for the quick update! As far as I can tell, it lumps the three types of Robohash robots into one, or is there a radio option I'm missing somewhere?
 
I wish there was options for that, but I was able to go in and manually edit the code in listener.php to limit it to one set and add a background so it fits my board's needs.

I guess what would be ideal is if future versions put a text field in user options where a forum owner could type in the preferred string.
 
I wish there was options for that, but I was able to go in and manually edit the code in listener.php to limit it to one set and add a background so it fits my board's needs.
While there, you might want to also add "&gravatar=hashed" to the end. That way if any of your users have gravatar avatars then they will be used instead of the RoboHash generated avatar. Without it any of your users that selected to use Gravatar will get a RoboHash avatar instead.
 
It wasn't happening in my case; the gravatar users were showing up with RoboHash images.
Make sure that your members have actually told XenForo to use their Gravatar. If they haven't chosen to display their Gravatar, then it'll default to RoboHash/Identicons.

gravatar_enabled.webp
 
Make sure that your members have actually told XenForo to use their Gravatar. If they haven't chosen to display their Gravatar, then it'll default to RoboHash/Identicons.

View attachment 80102
The user has chosen to use a Gravatar avatar. They have a Gravatar image on file. If I choose anything in the ACP other than RoboHash then their Gravatar image shows up. If I choose RoboHash then a RoboHash image shows up, not their Gravatar image.

In Listener.php if the ACP RoboHash option is chosen it loads an image from robohash.org, otherwise is uses gravatar.com to load an image. That means if RoboHash is chosen in the ACP then it will always load an image from robohash.org and not gravatar.com. The end result is that users will get a RoboHash image instead of their Gravatar image.

To get around that problem RoboHash supports the option of using Gravatar image first before generating a RoboHash image.
For Gravatar enthusiasts, you can ask Robohash to use a Gravatar if one is available.
Put either the email, or the hashed version, in your image where the string normally goes -

For example: http://robohash.org/colin@robohash.org?gravatar=yes
or http://robohash.org/620050a4db5104bae758cd75171d64ca?gravatar=hashed
Appending the robohash.org URL with the 'gravatar=hashed' option is all that's needed.
 
Appending the robohash.org URL with the 'gravatar=hashed' option is all that's needed.
What we have here is... me not having uploaded the correct version from my dev machine. D: Anyway, I'll upload that, and maybe add in some more of RoboHash's options once I get a spare moment. My weekend is rather solid.
 
hi, awesome addon iversia,

however, i noticed that all the guests that were allowed to post in the forum have similar avatars, is it possible to randomly generate identicon/avatars for each guests?

thanks so much!
 
however, i noticed that all the guests that were allowed to post in the forum have similar avatars, is it possible to randomly generate identicon/avatars for each guests?
FYI: The way identicons work is that they're based on a hash of the user's email. Unregistered users (guests) have no email to hash so they always get the same thing. One possible solution might be

IF email !== null
THEN use hashed email
ELSE use hashed IP
 
Hi StarArmy,

thanks for your reply, im bad at coding , can you advise me where i should include the code "
IF email !== null
THEN use hashed email
ELSE use hashed IP"

Thanks a lot
 
Can we have an option to disable HTTPS for the Robohash? I visited my site this weekend from my old tablet and it keeps giving me certificate errors every time I load a forum page with a Robohash avatar. My site isn't HTTPS and has no need for the avatars to be encrypted.
 
hi,

Im trying to edit the listener.php file so that a random identicon will be generated for guests, based on ip address. This is so that the thread list which are populated by posts from guests will have different identicons.

Code:
<?php

class Iversia_Identicon_Listener
{
    protected static $_helperCallbackAvatar;

    public static function initDependencies(XenForo_Dependencies_Abstract $dependencies, array $data)
    {
        self::$_helperCallbackAvatar = XenForo_Template_Helper_Core::$helperCallbacks['avatar'];

        if (self::$_helperCallbackAvatar[0] === 'self') {
            self::$_helperCallbackAvatar[0] = 'XenForo_Template_Helper_Core';
        }

        XenForo_Template_Helper_Core::$helperCallbacks['avatar'] = array('Iversia_Identicon_Listener', 'getAvatarUrl');
    }

    public static function getAvatarUrl(array $user, $size, $forceType = '', $canonical = false)
    {
        if (!empty($user['avatar_date']))
        {
            return call_user_func(self::$_helperCallbackAvatar, $user, $size, $forceType, $canonical);
        }

        if (!empty($user['user_id']) && $forceType != 'default')
        {
            if ($user['gravatar'] && $forceType != 'custom')
            {
                return self::_getGravatarUrl($user, $size);
            }
        }

        return self::_getDefaultAvatarUrl($user, $size);
    }

    protected static function _getDefaultAvatarUrl(array $user, $size)
    {
        $identicon = XenForo_Application::get('options')->IdenticonDefault;

        return self::_getGravatarUrl($user, $size, $identicon);
    }

    protected static function _getGravatarUrl(array $user, $size, $default = '')
    {
        $identicon = XenForo_Application::get('options')->IdenticonDefault;

        if ($user['user_id'] == null) {
            $md5 = md5($user['unique_key']);
        }
        else if (empty($user['gravatar'])) {
            $md5 = md5(strtolower(trim($user['email'])));
        } else {
            $md5 = md5(strtolower(trim($user['gravatar'])));
        }

        if ($default === '')
        {
            $default = '&d=' . urlencode($identicon);
        }
        else if (!empty($default))
        {
            $default = '&d=' . urlencode($default);
        }

        if (is_string($size))
        {
            $size = XenForo_Model_Avatar::getSizeFromCode($size);
        }

        if ($identicon == 'robohash' && empty($user['gravatar'])) {
            return "https://robohash.org/{$md5}?size={$size}x{$size}&set=any";
        } else {
            return (XenForo_Application::$secure ? 'https://secure' : 'http://www')
                . ".gravatar.com/avatar/{$md5}?s={$size}{$default}";

        }

    }
}

can anyone help me with this?
 
Hi,

I was under the impression this add-on generates an Avatar based on the IP address of the post. I used to uses 1.1.2, then upgraded to 1.2.1, but both version display IDENTICAL Avatars to all my guests. Naturally, each guest's post is coming from a different IP address. Why are they all getting an identical Avatar?
 
On the forum list all thread starter identicons are the same. When I click the member overlay, it shows their actual identicon. On the thread list the thread starter identicons are different, but wrong, clicking through to the user shows the correct identicon. Seems like this would be some kind of caching issue?
 
Top Bottom