• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Create Avatar link

#1
Hey,

I can get the database values for the avatar [gravatar] but I don't know whats the function to convert it into a avatar links o i can use it in my code without the template system. I seem to be stuck with it only. I need to pass the avatar as a JSON string.
 

Robbo

Well-known member
#2
Just had a quick look. Looks like you want XenForo_Template_Helper_Core::getAvatarUrls($user)?

PHP:
/**
    * Returns an array containing the URLs for each avatar size available for the given user
    *
    * @param array $user
    *
    * @return array [$sizeCode => $url, $sizeCode => $url...]
    */
    public static function getAvatarUrls(array $user)
    {
        $urls = array();

        foreach (XenForo_Model_Avatar::getSizes() AS $sizeCode => $maxDimensions)
        {
            $urls[$sizeCode] = self::getAvatarUrl($user, $sizeCode);
        }

        return $urls;
    }