Can't retrieve valid online presence data from Facebook with proper privilege set and user being online - facebook

I'm facing a trouble with some code that used to work before. I want to retrieve information whether user is currently online on Facebook's website chat. Thus, I'm requesting access token with 'user_online_presence' privilege and when running fql query:
"SELECT uid, name, pic_big, online_presence, status, current_location
FROM user
WHERE uid="+userId
(where userId is replaced by the real id of the user)
'online_presence' field is always 'offline' although I have my test account opened in the browser and test user is online for chat. All other information is presented correctly. And I know that this code used to work couple of months ago. I tried with several user account, but the same result always.
Is anyone facing similar issues? Has there been any API change I'm not aware of (I did search for the ones related to the online_presence field in 'user' table but without any success)?
Thanks a lot!

It's a long shot, but have you tried using WHERE id = me() rather than feeding in the user id?

Related

using the facebook graph to display profile pictures ...what if someone changes their username?

I am building a web app that will retrieve basic Facebook user information, among them also the profile photo, via
https://graph.facebook.com/USERNAME/picture?width=100&height=100
I plan on storing that variable in my database so that I can display the profile photos in the web app.
Now, I'm wondering what happens when someone changes their Facebook username from "jimmysmith" to "jamesdoe", for example? I assume that my saved URL of
https://graph.facebook.com/JIMMYSMITH/picture?width=100&height=100
will stop working? Is there any way around this?
Or will it still work because Facebook redirects the old username to the new username, maybe? I found no evidence of that, however. I have no way of testing it, either.
The way I retrieve it via FQL is:
$fql = "select uid, name, email, birthday from user wher.... etc.
Use the user IDs instead.
Usernames will not be query-able in v2.0 API.
See https://developers.facebook.com/docs/apps/upgrading for more information.

Get facebook user info

I'd like to know if it is possible to get userid or email for all people with same first name by using FQL and API. I mean all people with first name, like Mary, they don't have be my friends or fans. Thanks.
Not possible.
FB user must give you permission to query their account information. Until then, you can't get any information on them (so of course, you can't query every FB user named Mary).
No. You can't do that.
As Simon said FB user must give you permission to query their account information. An APP can access information for only those users, who have given that permission to the APP.
For example, the apps that you have mentioned in comment, social lead freak etc. will only show the results for those users which have given permission to that particular app. This means that there can be thousands of users on Facebook with the first name "Marry", but out of those thousands of users, only around 200 are using that APP (that is, have given permissions to access their data). Hope that explains the why they are doing that partially.

FQL: privileges to see a friend's posts

I'm trying to get all the posts of a friend with FQL, for some friend, I can retreive all the data needed but with someone other, I get an empty object as response, this is the query:
SELECT post_id FROM stream WHERE source_id=friendID
Knowing that I can actually see the friendID's posts through facebook, I tryed, to get the data through the api, adding a field in whitch use my id as id of the user who is asking for the data
SELECT post_id FROM stream WHERE source_id=friendID AND viewer_id=me()
I also tried this method, advised to me by another user:
SELECT post_id FROM stream WHERE actor_id=friendID AND source_id=me()
None of what i tried works, so, my questions are:
-This friend should grant me access to his data through the api? And how?
-There is an hack to bypass this problem?
-There is a way to understand if the user have 0 posts or I can't see his posts?
Thank you
Actually the problem is that your friend is not allowing apps to bring his info while you can see those data through your facebook account.
Why?
Go to Account Settings then go to Apps settings then select the option Apps other use.
just click here to directly open those settings https://www.facebook.com/settings?tab=applications&section=friends_share&view
You will see a list of categories and most of them are checked (See image below)... so if your friend unchecked the options that he doesn't want apps to access then you will not be able to access the info using an app while, as I said before, you can see these info from your Facebook account.
There is no solution for this because it's a privacy setting your friend prefer...
Note: if your friend added your app then app permissions will override the categories that don't permit the access of apps then queries will return info.
You can check it yourself. Create a temp facebook account and try changing those options and query the stream of your temp account with your main FB account. you will figure it out...

Some facebook friends' birthdays returning as null but I have the correct API permissions

I'm tring to get my friends' birthdays in my app and some of them are null. I thought that those people don't have a birthday set, but they actually do.
My fql query is:
SELECT uid,name,birthday_date FROM user WHERE uid IN (SELECT uid2 from friend where uid1=me())
The birthdays are also null when I request /me/friends?fields=birthday
My access token has the friends_birthday permission set.
I also tried with birthday instead of birthday_date in the FQL query. Same result.
I imagine that this happens because they opted out somehow, but I don't know how.
Is there an alternate solution to actually get their birthdays from facebook?
It's also possible to remove the ability of apps to access your data when your friends use them, this option will prevent the current session user from seeing some information about their friends via the API, even if that information is accessible on Facebook.com
This setting is in the privacy settings, at https://www.facebook.com/settings/?tab=privacy, under Ads, Apps and Websites -> 'How people bring your info to apps they use' and looks like this:
{edit} you can test this for yourself with test users, it's the most likely reason assuming the birthdays are visible to you in the frontend
These people might have set their Birthdays visible to only themselves or only some restricted friends. This is an option available if we try to edit our Birthday by its side. That can cause it is not available to your query by app.

Can't obtain valid Facebook user_online_presence information

This used to work for me before, but some time ago I realised it doesn't work any more. I'm trying to run a FQL query for retrieving user_online_presence status (whether user is available for chat) on facebook. So, my query goes like this:
SELECT online_presence FROM user WHERE uid=userID
where userID is the actual user id on facebook.
But, regardless I'm online or offline on facebook, this query always gives me 'offline' status instead of 'active' (or 'idle').
To reproduce this on your own, simply go to the Graph API Explorer, obtain a token with permission user_online_presence, and type in the box:
fql?q=SELECT uid,online_presence FROM user WHERE uid = me()
I would really appreciate if anybody can help me with this. Thanks!