Two different avatars for the same user? What's happening?

oPryzeLP

New member
Hello,

I recently made a post similar to this issue with no luck.
Here is the original thread just in case: https://xenforo.com/community/threads/avatar-based-on-custom-user-field-problems.86381/

My second question expands on that a little bit in hopes to find a solution. How is it possible that a user can have two DEFAULT avatar images? I don't understand.

This is the code from Core.php where I tell it to set the default avatar to that of an image based on a custom field.

Code:
protected static function _getDefaultAvatarUrl(array $user, $size)
    {
        $customFields = unserialize($user['custom_fields']);

        if(!empty($customFields['_minecraft_username']))
        {
            return "http://cravatar.eu/helmavatar/{$customFields['_minecraft_username']}/".XenForo_Model_Avatar::getSizeFromCode($size).".png";
        }
        else
        {
            return "http://cravatar.eu/helmavatar/steve/".XenForo_Model_Avatar::getSizeFromCode($size).".png";
        }
    }

As you can see, if the field is empty, if(!empty($customFields['_minecraft_username'])) I tell it to use a different image (aka, the true 'default' avatar).

To my understanding, a user can only have ONE default avatar image to their name. Yet on my website, the small versions of avatars use the true default image, while the large versions of avatars use the one based on the custom field.

Why is this happening?

-It happens for every user EXCEPT for users that have uploaded a custom avatar.
-I'm using XenPorta, however this problem persists outside of that add-ons scope.

Please help :(
 
My intent was to simplify the understandability of my second question. This post was intended to help me understand the next step to fixing the problem. As you can see, this posts question can hold its own just fine. I included the code required to understand it and the question does NOT rely on knowledge of the other post. I simply included it for reference "just in case."
 
Back
Top Bottom