Topic-icon Get facebook avatar in my own code

Active Subscriptions:

None
Hi Alex,

I hope you can help me with some questions... I'm need show the customer picture/avatar from Facebook in my own module, I'm looking for a solution in the helper.php of mod_sclogin.
    function getFacebookAvatar()
    {
        $html = "";
        if ($this->isJFBConnectInstalled)
        {
            $fbUserId = $this->jfbcLibrary->getMappedFbUserId();

            # Show their FB avatar (if desired), or give them the option to link accounts
            if ($fbUserId)
            {
                $fbProfileURL = 'https://www.facebook.com/profile.php?id='.$fbUserId;
                $fbAvatarSize = $this->getJFBConnectAvatarSize();
                $fbAvatarURL = 'https://graph.facebook.com/'.$fbUserId.'/picture?type='.$fbAvatarSize;

                if($this->showSecurely())
                    $fbAvatarURL .= '&return_ssl_resources=1';

                $html = $this->getSocialAvatarImage($fbAvatarURL, $fbProfileURL);
            }
        }
        return $html;
    }

How can I use this code in my new module to get the avatar from Facebook?

Please help.
The topic has been locked.
Active Subscriptions:

None
13 years 2 months ago #32463 by carlos.sandoval
I've solved this, thanks Alex. :D
The topic has been locked.
Support Specialist
13 years 2 months ago #32468 by alzander
Carlos,
Glad you found a solution that works for you. The code above will work for the currently logged in user. If you're looking to show the avatar of a different user that may have logged in with Facebook, the code would be a bit different. If you'd like to know more about how to do that, just let us know.

Thanks,
Alex
The topic has been locked.