select first_name, last_name, uid from user where uid in (select uid2 from friend where uid1=me() and uid2 **not** in(SELECT user_id FROM like WHERE object_id={0}))
But the not is not recognised by facebook. How do you solve this issue?
without the not, you will get the list of all friends who like something
Don't think there is a direct way to do this. You might need to do batch queries, one to get the uids of all your friends who have liked a particular object, and compare them against the list of friend-ids and eliminate the matches.
Related
I am building a website with venues (for exaple cinemas) and i need to show to the user (user logged in with facebook) his/her friends that have checked in to this place.
I am using long, lat for my places. I am thinking of using a query that will bring the check ins from user;s friends, that are specified by a location center and a distance:
https://graph.facebook.com/search?type=location¢er=38.01166,23.69272&distance=30&access_token=AAAAAAITEghMBAOL5MyxLDoFpRlirSFmEYYGZB7tHd8BH8YsUOW03uX4ewz6lVVPFWudujS0RZC7HdXm2r7OfVvnEgSr3KqRw4Q5WqlEeCNYm07XxyO
Is the query right? Is there any better way? How am i going to show to the venue page on my website, the users' profile pics?
What i realy need to create is something like this!(from tripbirds.com)
but i only want to show their photo not their post on that place.
http://imageshack.us/photo/my-images/13/22811412.png/
Since each place has its own page_id, you can use the checkin table and friend table to construct a query like -
select author_uid from checkin where page_id = [PLACEID_WHERE_CHECKEDIN] and author_uid in (select uid2 from friend where uid1 = me())
And once you have the friends' id, it's simple to get their info and profile pic from the user table. If you really wanted to do it in 1 query, you could enclose the above in a query like -
select pic_square from user where uid in (ABOVE-QUERY)
I need to find out who all(my friends only) are tagged in a specific photo. I know the pid of the photo. This needs to be done via a FQL query.
Any help?
Here you go. This will give you most of the data you should need about a friend tagged in a specific photo.
SELECT id, name, pic_square, username, type FROM profile WHERE id IN
(SELECT subject FROM photo_tag WHERE pid = XXXXX AND subject IN
(SELECT uid2 FROM friend WHERE uid1 = me() ) )
You may not get all your friends with this query who are visible in the Facebook app. This depends on how they have their privacy settings configured. The API won't return their data to you if their privacy isn't set to public.
Depending on how you're getting it, you may want to sub out object_id for pid. The pid field seems like it's on the path to deprecation.
I cannot figure a way get friends only with profile photos. I could use multi-query to check whether every friend has a photo, but that would incur heavy traffic.
Are there any alternatives?
Although Gajus’ suggested query might work right now, it’ll break once Facebook changes the URL of the default picture on their CDN. (Might happen, might not happen.)
So I’d suggest this for improvement:
The profile_pic table has a field called is_silhouette, which is a boolean for whether the user has their own profile picture set or not.
So to get only those of your friends, that have a profile picture set, you can use
SELECT uid, name FROM user WHERE uid IN
(SELECT id FROM profile_pic WHERE
id IN (SELECT uid1 FROM friend WHERE uid2 = me() )
AND NOT is_silhouette
)
–> Try this query in the Graph API Explorer.
This can be achieved with a simple FQL.
SELECT uid, name, pic_small FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND pic_small != 'https://fbcdn-profile-a.akamaihd.net/static-ak/rsrc.php/v1/yP/r/FdhqUFlRalU.jpg'
The seb-query will get all yours friend uids. The other query will match does uids with the profile data check if the pic_small is referring to what Facebook uses as a placeholder.
You can quickly test it here.
Is it possible to get all liked movie pages via FQL?
The most stable way currently to get the names of the pages not necessarily the ids would be to run a query on the user table. page_fan returns little to no results even though the user may have numerous pages likes of type Movie.
SELECT movies from user where uid=me() and movies != ''
or for all friends
SELECT movies from user where uid in (SELECT uid2 FROM friend WHERE uid1 = me()) and movies != ''
There is currently no way to get all like movie pages of a user (in terms of ids) via FQL.
Update: I jumped the gun.
This should work
SELECT name, page_id from page where page_id in (SELECT page_id from page_fan where uid in (SELECT uid2 FROM friend WHERE uid1 = me()) and profile_section='movies')
Though it's still unstable and doesn't return all matches >.<
Yes it is. Check out the Graph API Explorer. You can run FQL statements on the page_fan table from there. You'll need to require the user_likes permission and then parse out the movie entries. that field is not index.
yes, just query the FQL page_fan table http://developers.facebook.com/docs/reference/fql/page_fan/ with the correct permissions.
Is there any fql statements allowed by facebook that helps to fetch contents of this page through an application interface: http://www.facebook.com/posted.php I know the links table returns the posted item for a logged in user (http://developers.facebook.com/docs/reference/fql/links). I need the same but for the logged-in user's friends.
Thanks.
you can use Fql query or Graph API to get your friends data.
Sometimes you will not get all information from the graph like birthdate of your friends but yes you can use fql queries to solve your probs.
here is an exmple for you.
create first facbook object and the use it.
$query = "SELECT uid, first_name, last_name, birthday_date, sex, pic_square, current_location, hometown_location FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND birthday_date != 0 ORDER BY birthday_date";
Regards,
Archit.
You can do this through an FQL query - though you may need to use multiple queries if you require more information about the friend who posted the link:
select title, owner from link where owner in (select uid2 from friend where uid1 = me() limit 100)
You may want to limit the number of friends (or even the links themselves) as this can be a costly query