× Joomla Facebook Connect support forum

Topic-icon Display Facebook picture in virtuemart login module

Active Subscriptions:

None
13 years 11 months ago #23762 by elhajj
I have implemented jfbconnect and am using virtuemart login module and not the SC login module. Is there a way to display Facebook picture of the user after he login in the virtuemart login module?

I like the function of displaying Facebook picture on SC login module and would love to implement it in the virtuemart module but need some help with that.

Thank you in advance
The topic has been locked.
Support Specialist
13 years 11 months ago #23772 by alzander
elhajj,
There's a few different ways to show the Facebook avatar. When it's shown in the SCLogin module, it's only pulled from Facebook in real time, it's not actually stored on your system in that case. However, it is a good reassurance for your user's that they are properly logged in with the account you expect. Just wanted to clarify ahead of time that the avatar is not imported into Virtuemart or anything like that.

If you still want to show it in your VM login module, that shouldn't be too difficult to figure out the code to do that. Could you please post from the account you subscribed to JFBConnect from though? Priority support and investigation takes time and is only for active subscribers only.

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

None
13 years 11 months ago #23773 by mushaj
Dear Alzander,
I thought i have subscribed from the other one, only to remember now that i have used login with facebook to subscribe. Now i should be logged in from the user with subscription. Could you please support me with this? I still want to show it in my VM login module.

Thank you in advance.
The topic has been locked.
Support Specialist
13 years 11 months ago #23823 by alzander
Mustapha,
The way we get the avatar image in the SCLogin module is below. I've modified it slightly to remove some unnecessary code if you're implenting it directly. This should get you going though:
$jfbcLibrary = JFBConnectFacebookLibrary::getInstance();
$fbUserId = $jfbcLibrary->getMappedFbUserId();
if ($fbUserId)
{
      $fbProfileURL = 'https://www.facebook.com/profile.php?id='.$fbUserId;
      $fbAvatarURL = 'https://graph.facebook.com/'.$fbUserId.'/picture?type=large&return_ssl_resources=1';
       echo '<img src="' . $fbAvatarURL . ' width="50" height="50" />';
}
That code will check to make sure the user is logged into through Facebook first. If not, it won't show any avatar. You can change the width and height as well, of course, to suit your needs.

Hope that helps, but if you need anything else, or run into issues, just let me know!

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

None
13 years 11 months ago #23853 by mushaj
This worked amazingly, Thank you very much for the support. One last question, can i change the size of this image? If for example i would like it to be bigger?
The topic has been locked.
Support Specialist
13 years 11 months ago #23861 by alzander
Awesome, glad to hear that worked! Yes, you can change the size. In that second to last line that starts with 'echo' simply change the width and height numbers (currently at 50) to whatever size you want.

If the image gets blocky/pixellated, just let me know and we can help improve that up to a size of about 200x200 (I think).

Thanks,
Alex
The topic has been locked.