Topic-icon Get profile picture in other compenents

Active Subscriptions:

None
10 years 7 months ago - 10 years 7 months ago #35918 by guamen1
Hello
I'm using a component called ccomments.
I was wondering if I can use JFBConnect to add the user's avatar for comments without having to install extra components.
Something like a php function that calls the users profile pic and place it on comments
Is it possible?
Is there a better approach to do this?
Thanks
Last edit: 10 years 7 months ago by guamen1.
The topic has been locked.
Support Specialist
10 years 7 months ago #36105 by alzander
Guayo,
Sorry for the delay in getting back to this. We don't have a predefined function to do exactly what you're saying, but it actually should be very simple to do so. I'm going to try and get you an answer in the next day or so. Just wanted to let you know that I haven't forgotten about you.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
10 years 7 months ago #36319 by guamen1
Hi Alex!
Any news about this?
Any clue would be appreciated!
The topic has been locked.
Support Specialist
10 years 7 months ago #36395 by alzander
Guayo,
Sorry for the delay in getting back to this. The code below should work for fetching an avatar from the social network for a user. You'll need to test the cases where a user hasn't connected with Facebook or Google and ensure it works how you want. I tested this quickly, but definitely not enough:
$fbId = JFBCFactory::usermap()->getProviderUserId($jUserId, 'facebook');
if ($fbId)
    $avatarUrl = JFBCFactory::provider('facebook')->profile->getAvatarUrl($fbId, true);
The $avatarUrl will either be null (empty) or the actual URL of the user's avatar.
In the above, you can change 'facebook' to 'google' to do the same for Google.

Let me know how that goes or if you run into any other issues.

Thanks,
Alex
The topic has been locked.