Additional Permissions Request problem

Additional Permissions Request problem

Hi,

Although , although user_birthday & user_about_me are set in Additional Permissions Request, PHP API does not return birthday & bio.

Please advice.

Kind regards,

Manos

"We are the Borg. Lower your shields and surrender your ships. We will add your biological and technological distinctiveness to our own. Your culture will adapt to service us. Resistance is futile."
7of9
useravatar
Offline
110 Posts
Active Subscriptions:

None
Administrator has disabled public posting. Please login or register in order to proceed.

Re: Additional Permissions Request problem

What extension are you trying to pull that information into? You should need to add the user_birthday or user_about_me permissions manually to JFBConnect, those should be automatically determined when you configure the Social Profile plugin(s) to import that data.

Let me know a little more about your configuration, and we'll help how we can.

Thanks,
Alex

If you use our extensions, please consider leaving a rating and review at the Joomla! Extension Directory:
JFBConnect | SCLogin

alzander
Alex
useravatar
Offline
23813 Posts
Support Specialist
Administrator has disabled public posting. Please login or register in order to proceed.

Re: Additional Permissions Request problem

Hi,

I am not using any extension to import the information into. Just PHP code.
// Create Application instance (replace this with your appId and secret).
$facebook = new Facebook(array(
  'appId' => 'I use my appid here',
  'secret' => 'I use my secret here',
  'cookie' => true
));
//Get user profile details
$user_profile = $facebook->api($_POST["fbid"],'GET');
echo "Bio: " . $user_profile['bio']."";
echo "Birthday: " . $user_profile['birthday']."";

Any other information I try to access, like this, ie likes, gender, locale, works fine. However these two information fields return empty, although, I have added the permissions in Additional Permissions Request of JFBConnect component.
ie:
echo "Locale: " . $user_profile['locale']."";

works fine.

Thanks in advance.

"We are the Borg. Lower your shields and surrender your ships. We will add your biological and technological distinctiveness to our own. Your culture will adapt to service us. Resistance is futile."
7of9
useravatar
Offline
110 Posts
Active Subscriptions:

None
Administrator has disabled public posting. Please login or register in order to proceed.

Re: Additional Permissions Request problem

Can you test on the Facebook debugger site and see if the data comes in properly?
https://developers.facebook.com/tools/e … mp;path=me

Or, for a specific field:
https://developers.facebook.com/tools/e … elds%3Dbio

Let me know if that works. If not, it's likely an indication that that field either doesn't exist in your profile or is set to be private.

Thanks,
Alex

If you use our extensions, please consider leaving a rating and review at the Joomla! Extension Directory:
JFBConnect | SCLogin

alzander
Alex
useravatar
Offline
23813 Posts
Support Specialist
Administrator has disabled public posting. Please login or register in order to proceed.

Re: Additional Permissions Request problem

Hi Alex,

Bio displays correctly. However birthday is not displayed at all. (My birthday is set to be displayed without the year in facebook)
Those pages however use an access token, not an app. Since in my app I have clearly given the right to access those fields, shouldn't that info be available, regardless if it's private or not?

Thanks in advance.

Kind regards,

Manos

"We are the Borg. Lower your shields and surrender your ships. We will add your biological and technological distinctiveness to our own. Your culture will adapt to service us. Resistance is futile."
7of9
useravatar
Offline
110 Posts
Active Subscriptions:

None
Administrator has disabled public posting. Please login or register in order to proceed.

Re: Additional Permissions Request problem

There's 2 options for the authentication token to test with:
* In the top right of the debugger, use the "Application:" drop down to select your application.. then click the "Get Access Token" button. You can set the permissions there, but they should already be defaulted to what you've granted for your app.
* You can look in the xyz_jfbconnect_user_map table for your user and pull the access token from there to test with. Copy it and paste it into the debugger Access Token field.

Test with that and let us know if you can get the right information from there. Beyond that, I'm not sure why you can't get those fields. When we're developing, we always explicitly state the fields we want to fetch instead of trying to get the whole profile. That may be something you also want to try instead of the generic call you're using.

Keep me posted on how the tests go.

Thanks,
Alex

If you use our extensions, please consider leaving a rating and review at the Joomla! Extension Directory:
JFBConnect | SCLogin

alzander
Alex
useravatar
Offline
23813 Posts
Support Specialist
Administrator has disabled public posting. Please login or register in order to proceed.

Re: Additional Permissions Request problem

Hi Alex,

Yes, that way I get the information. However, I should not require an Access Token in order to get this information, according to the FB API, should I?
So far I have not used an Access Token in my code. How do I use it?

Thanks again!

"We are the Borg. Lower your shields and surrender your ships. We will add your biological and technological distinctiveness to our own. Your culture will adapt to service us. Resistance is futile."
7of9
useravatar
Offline
110 Posts
Active Subscriptions:

None
Administrator has disabled public posting. Please login or register in order to proceed.

Re: Additional Permissions Request problem

As far as I know, the permissions are always required for birthday. Not sure about bio offhand honestly.

I just re-looked at your code and would highly recommend updating it a bit to use JFBConnect more. You're re-instantiating the Facebook library (which is slower) and avoiding a lot of great functionality in JFBConnect. If you're up for a minor update of your code, I'd recommend changing it to the following:

Code:

$profileLibrary = JFBConnectProfileLibrary::getInstance();

$jfbcLibrary = JFBConnectFacebookLibrary::getInstance();
$fbUserId = $jfbcLibrary->getFbUserId(); // This is the current user logged in through Facebook
$fbUser = $profileLibrary->fetchProfile($fbUserId, array('bio', 'locale', 'birthday'));
$bio = $fbUser->get('bio', ''); // default of 'blank' in case nothing is returned
$locale = $fbUser->get('locale', 'en_GB'); // default of 'en_GB'
...

That will use JFBConnect to fetch the information. The benefits are that you have error checking, a lot of checks in the code, and you can easily set a default in case nothing comes back. It also will use the user's current authentication token, which should have the permissions they granted on login.

Hope that all helps, but if not, let me know!

Thanks,
Alex

If you use our extensions, please consider leaving a rating and review at the Joomla! Extension Directory:
JFBConnect | SCLogin

alzander
Alex
useravatar
Offline
23813 Posts
Support Specialist
Administrator has disabled public posting. Please login or register in order to proceed.

Re: Additional Permissions Request problem

Hi Alex,

Thanks for the help. What I need is a code to read all users' information who have subscribed using JFB, in my site, according to the permissions my app allows and are set in JFB.

Thanks in advance.

"We are the Borg. Lower your shields and surrender your ships. We will add your biological and technological distinctiveness to our own. Your culture will adapt to service us. Resistance is futile."
7of9
useravatar
Offline
110 Posts
Active Subscriptions:

None
Administrator has disabled public posting. Please login or register in order to proceed.

Re: Additional Permissions Request problem

There isn't a way to query Facebook for 'any available data'. The query you were originally doing with the just a "GET" call gets the basic profile information about a user. You'd need to specifically query Facebook for the fields you want to get. To our knowledge, you can't say "Get me all data that the user has approved", you have to specifically query for each of those extended fields. You can even query for fields you don't have permission for, you'll just get a blank response.

Sorry I don't have any better answers, but querying for the specific fields you want will also minimize traffic to Facebook and their responses, which can speed up the overall process as well.

I hope that helps,
Alex

If you use our extensions, please consider leaving a rating and review at the Joomla! Extension Directory:
JFBConnect | SCLogin

alzander
Alex
useravatar
Offline
23813 Posts
Support Specialist
Administrator has disabled public posting. Please login or register in order to proceed.

Re: Additional Permissions Request problem

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.

"We are the Borg. Lower your shields and surrender your ships. We will add your biological and technological distinctiveness to our own. Your culture will adapt to service us. Resistance is futile."
7of9
useravatar
Offline
110 Posts
Active Subscriptions:

None
Administrator has disabled public posting. Please login or register in order to proceed.

Re: Additional Permissions Request problem

You can read the $fbUserId from the database in a few ways:
If you have the Joomla user id:

Code:

$userMapModel = new JFBConnectModelUserMap(); 

$fbUserId = $userMapModel->getFacebookUserId($joomlaUserId)

The currently logged in user:

Code:

$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

If you use our extensions, please consider leaving a rating and review at the Joomla! Extension Directory:
JFBConnect | SCLogin

alzander
Alex
useravatar
Offline
23813 Posts
Support Specialist
Administrator has disabled public posting. Please login or register in order to proceed.

Re: Additional Permissions Request problem

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!

"We are the Borg. Lower your shields and surrender your ships. We will add your biological and technological distinctiveness to our own. Your culture will adapt to service us. Resistance is futile."
7of9
useravatar
Offline
110 Posts
Active Subscriptions:

None
Administrator has disabled public posting. Please login or register in order to proceed.

Re: Additional Permissions Request problem

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

If you use our extensions, please consider leaving a rating and review at the Joomla! Extension Directory:
JFBConnect | SCLogin

alzander
Alex
useravatar
Offline
23813 Posts
Support Specialist
Administrator has disabled public posting. Please login or register in order to proceed.

Re: Additional Permissions Request problem

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.

"We are the Borg. Lower your shields and surrender your ships. We will add your biological and technological distinctiveness to our own. Your culture will adapt to service us. Resistance is futile."
7of9
useravatar
Offline
110 Posts
Active Subscriptions:

None
Administrator has disabled public posting. Please login or register in order to proceed.

Re: Additional Permissions Request problem

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

If you use our extensions, please consider leaving a rating and review at the Joomla! Extension Directory:
JFBConnect | SCLogin

alzander
Alex
useravatar
Offline
23813 Posts
Support Specialist
Administrator has disabled public posting. Please login or register in order to proceed.

Re: Additional Permissions Request problem

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

"We are the Borg. Lower your shields and surrender your ships. We will add your biological and technological distinctiveness to our own. Your culture will adapt to service us. Resistance is futile."
7of9
useravatar
Offline
110 Posts
Active Subscriptions:

None
Administrator has disabled public posting. Please login or register in order to proceed.

Re: Additional Permissions Request problem

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:

Code:

    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:

Code:

$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

If you use our extensions, please consider leaving a rating and review at the Joomla! Extension Directory:
JFBConnect | SCLogin

alzander
Alex
useravatar
Offline
23813 Posts
Support Specialist
Administrator has disabled public posting. Please login or register in order to proceed.
There are 0 guests also viewing this topic
There are 0 users also viewing this topic

Board Info

Board Stats
 
Total Topics:
11499
Total Polls:
0
Total Posts:
48411
Posts today:
5
User Info
 
Total Users:
47473
Newest User:
martinpleon
Members Online:
1
Guests Online:
925

Online: 
jeffhoneyager
Social Stream
Refer and Earn

Like our extensions? You're not alone! That's why they're used on tens of thousands of websites. Now you can earn 20% of any sale you refer to SourceCoast.com.

We provide excellent documentation, well laid out sales pages and great support. All you need to do is spread the word and we'll take care of the rest.

Learn About Our Affiliate Program