Topic-icon Additional Permissions Request problem

Active Subscriptions:

None
11 years 3 weeks ago #32279 by 7of9
I don't think there is a performance issue here, since this operation will be performed only once.

So, if I call:
$fbUser = $profileLibrary->fetchProfile($fbUserId, array());

Won't it return all the profile info?
Also, how can I read the $fbUserId, from JFB db?

Thanks in advance.
The topic has been locked.
Support Specialist
11 years 3 weeks ago #32290 by alzander
You can read the $fbUserId from the database in a few ways:
If you have the Joomla user id:
$userMapModel = new JFBConnectModelUserMap(); 
$fbUserId = $userMapModel->getFacebookUserId($joomlaUserId)
The currently logged in user:
$jfbcLibrary = JFBConnectFacebookLibrary::getInstance(); 
$fbUserId = $jfbcLibrary->getFbUserId(); // This is the current user logged in through Facebook

As for your call to fetchProfile with an empty array, I don't believe that will return the whole profile. It should (I think) return all the basic info about a user that you can get just by them approving your app. That should be the same as you're "GET" call above. It *won't* return any extended information that required the user's permission to read. That's just how Facebook works.. you need to query for specific fields if you want them, or you can get the generic/basic profile by just making an empty call.

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

None
11 years 3 weeks ago #32316 by 7of9
Hi Alex,

Thanks for your help.
What I am trying to do is, at the user registration store the user profile information (all the information the user agrees to share) locally.
I am using J3.0, JFB & Jomsocial. Is there a quick way to do it, with minimal coding?
This is the Additional Permissions Request field in JFC:
user_about_me,user_activities,user_birthday,user_checkins,user_education_history,user_events,user_groups,user_hometown,user_interests,user_likes,user_location,user_notes,user_photos,user_questions,user_relationships,user_relationship_details,user_religion_politics,user_status,user_subscriptions,user_videos,user_website,user_work_history,email,read_friendlists,read_stream,user_online_presence,friends_online_presence

Thanks again!
The topic has been locked.
Support Specialist
11 years 3 weeks ago #32321 by alzander
You'd want to make a request, like I noted above, with all the fields you want to get for the user. You'll need to make the fetchProfile request with all the fields you are requesting permission for, as there's no way to just say "Give me all fields".

Once you have the profile, you can store it however you want.

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

None
11 years 3 weeks ago #32325 by 7of9
Hi Alex,

So there is no quick way to do it, with minimal coding, by utilizing JFB & Jomsocial, right?
I was hoping there was a plugin that could save the information using Jomsocial extended profile.

Thanks in advance.
The topic has been locked.
Support Specialist
11 years 3 weeks ago #32332 by alzander
If your simply importing in the JomSocial profile for the user, why don't you just use the Social Profiles - JomSocial plugin that is included in the JFBConnect package? Once installed and enabled, you can easily set which fields from Facebook are imported into JomSocial. JFBConnect will automatically determine which permissions are required and take care of everything for you. You should need to add any code or set any "Additional Required Permissions" for that to work.

I thought you were doing something special like storing the profile data in a custom table. If you're simply storing in JomSocial, we support that already and we'd recommend using our plugin for that.

If you have any questions, just let us know.

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

None
11 years 3 weeks ago #32340 by 7of9
Hi Alex,

I have tried that, however the field mapping only shows me the following:
Birthdate
About me
Mobile phone
Land phone
Address
State
City / Town
Website
College / University
Graduation Year

All the rest of the info is missing.
Please advice.

EDIT: Fields missing are: Gender, Country
The topic has been locked.
Support Specialist
11 years 3 weeks ago #32350 by alzander
Those specific fields (gender/country) don't show because they are select boxes, which means the data returned from Facebook may not directly line up with the options you have available.

If you want them to display in the Profiles area, you can update our /plugins/socialprofiles/jomsocial/jomsocial.php file. Around line 41, you'll see:
protected function getProfileFields()
    {
        $query = 'SELECT * FROM #__community_fields WHERE type="text" OR type="textarea" OR type="date" OR type="birthdate" OR type="url" ORDER BY ordering';
Update that query to be:
$query = 'SELECT * FROM #__community_fields WHERE type="text" OR type="textarea" OR type="date" OR type="birthdate" OR type="url" OR type="gender" OR type="country" ORDER BY ordering';
You'll need to test though that the data imported from Facebook works in the fields you're importing to. Mainly, for gender, Facebook returns "Male" or "Female", I believe. If your options are "Boy" and "Girl", then some users will have Facebook's response (Male) while others that register through JomSocial will be "Boy".

Country shouldn't be much of an issue, but again, things like "USA" vs "United States" or "United States of America" could be different when imported from FB vs selected in JomSocial.

Hope that helps,
Alex
The topic has been locked.