Create Avatar link


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.


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

    * 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;