Topic-icon Possible to display profile images from JFBConnect in another module?

Active Subscriptions:

None
Just installed JFBConnect 6.2.3. Great component! Nice to have something which is so simple to get running and had so much thought put into it.

I have one issue. I'm using Ohanah and I want to display the avatars in their attendees module. It currently pulls Gravatar images but I want to display these from JFBConnect profile images. JFBConnect is working great and profile pictures are imported fine into user map.

The email of the user is already in the module so we wondered whether we can use this to display the profile image? Can we use this? There may be a better way.

I am sure it is very simple but cannot think of the solution. Sorry!

Suspect others will find this helpful in future too if we can get it working.

Many thanks in advance!

Ashley
The topic has been locked.
Support Specialist
Ashley,
We do store the URL to a user's avatar from different social networks as a parameter in the database for each user. Right now, we use that URL only in the admin area for usermap. In general, we recommend using a full-fledged 3rd party profile extension if you want to show avatars in other extensions. However, you could use the parameter we save and put that in your code to show the URL directly from the social network for the user.

I honestly don't know Ohanah well enough to tell you what code to replace. The code below is what you would want to use to check if there is an avatar URL stored for the user in JFBConnect and use it if set:
$userModel = JFBConnectModelUserMap::getUser(123, 'facebook');
$userData = $userModel->getData();
if($userData->params->get('avatar_thumb') != '')
   $imageURL = $userData->params->get('avatar_thumb');
else
   $imageURL = //get Gravatar image here
That's completely untested code, but it should work right away (if I didn't get any typos in there). Please make sure you update the 123 with the actual user id that would be coming in from Ohanah for the user. Also, right now, that code only checks for Facebook avatars. It'd be more complex to add checks for other social networks... so lets start there.

If you get that working though, we'd love to hear about it. I can see adding a better "getUserAvatar" function which would find if any network has a URL set for the user and to pull it, but we'll get there in baby steps :)

Keep us posted, and good luck,
Alex
The topic has been locked.
Active Subscriptions:

None
Thanks Alex for the help and code. We're doing some work on it now and I'll let you know if we have success.

Ashley
The topic has been locked.