Topic-icon Get information from Facebook cookie

Active Subscriptions:

None
Hi Alex,

I'm developing my own component for my web site and I have an user form with some fields... I'd like use the Facebook cookie created with your component and fill some fields automatically.

Can you help me with some code or idea please?

Thanks in advance. :=D
The topic has been locked.
Support Specialist
13 years 1 month ago #32810 by alzander
To do it PHP (server-side) before the form is actually sent to the user's browser, you'd just need to add some code like:
$profileLibrary = JFBConnectProfileLibrary::getInstance();
$fbUser = $profileLibrary->fetchProfile($fbUserId, array(0 => 'first_name', 1 => 'last_name'));
echo $fbUser->get('first_name');
You can see a alot of the fields you can get on the User Object documentation page of Facebook.

Hope that gets you started, but if you need something else, just let us know.

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

None
13 years 1 month ago #32824 by carlos.sandoval
Thanks Alex,

I was reviewing your code and I have this function:
	function test()
	{
	$libFile = JPATH_ROOT . '/components/com_jfbconnect/libraries/facebook.php';
        require_once($libFile);
		
	$jfbcLibrary = JFBConnectFacebookLibrary::getInstance();
        $fbUserId = $jfbcLibrary->getFbUserId();
	$profileLibrary = JFBConnectProfileLibrary::getInstance();
        $fbUserProfile = $profileLibrary->fetchProfile($fbUserId, array('first_name', 'last_name', 'email', 'name', 'education'));
		
		
		$fbMemberName = $fbUserProfile->get('name');
		$themail = $fbUserProfile->get('email');
		$nombre = $fbUserProfile->get('first_name');
		$apellido = $fbUserProfile->get('last_name');
		$edu = $fbUserProfile->get('education');
		
		return $themail.','.$nombre; //name, email, firstName, lastName.
	}

With this way I think I'll get all the fields as you mentioned in the link developers.facebook.com/docs/reference/api/user/

TY.
The topic has been locked.
Active Subscriptions:

None
13 years 1 month ago #32825 by carlos.sandoval
Alex,

I can't get some fields... gender, birthday and location.

Can you help me please?

I'm reviewing your class: JFBConnectProfileData

TY
The topic has been locked.
Support Specialist
13 years 1 month ago #32829 by alzander
The code above looks great. For the extended fields, you'll need to make sure you're requesting those permissions at login. For Birthday, for example, you need to request "user_birthday". You can see the permissions required for each field in the documentation page you included above.

Once you have the permissions you want, add them as comma-separated values into the Configuration -> Facebook API -> Additional Required Permissions setting like:
user_birthday,user_education,etc,etc

Hope that helps,
Alex
The topic has been locked.
Active Subscriptions:

None
13 years 1 month ago #32831 by carlos.sandoval
Ty Alex,

I get it, I'll try it.

Thanks so much. :D
The topic has been locked.
Active Subscriptions:

None
13 years 1 month ago #32835 by carlos.sandoval
I can't get this info... birthday is OK, but Location and gender is my big problem in the top function when I modify it as:
$fbUserProfile = $profileLibrary->fetchProfile($fbUserId, array('name', 'email', 'first_name', 'last_name', [color=#ff0000]'gender'[/color]));

And if I want return any field (variable) it don't display some value.

If I remove "gender" of this array I can use normally this function, the same case is for location/user_location or hometown/user_hometown in the array...

I have applied the appropriate permissions in the application. Please help. =(

Sorry my bad English.

TY.
The topic has been locked.
Active Subscriptions:

None
13 years 1 month ago #32836 by carlos.sandoval
OH! I get the solution, thank you so much. Finally I looked at the profile file (.../comoponents/com_jfbconnect/libraries/profile.php) Great Job my friend :D

I'm more than happy with this joomla tool. TY :D
The topic has been locked.
Support Specialist
13 years 1 month ago #32838 by alzander
Glad to hear you got it going! Should you need anything else, don't hesitate to let us know.

Finally, if you haven't already, please consider leaving a rating and review for JFBConnect, or our support, on the Joomla Extension Directory. It certainly isn't required, but is very appreciated:
extensions.joomla.org/extensions/social-...ook-integration/7215

Thanks,
Alex
The topic has been locked.