Displaying list of users of a facebook application - facebook

Am working on a facebook application and i will like to display to the user his/her friends that are already users of the application.
I have been able to get the facebook user ids of the users. Now am trying to find out if there is a facebook api resource i can use to render the user's pictures and names by just passing the ids to it.
thanks in advance.

You should try out with FQL and the user table.
http://developers.facebook.com/docs/reference/fql/user/
There you have a is_app_user field, which can be queried. The table is indexed by uid, which means you can use ids of friends to check.
With fql like this you should be able to read all friend ids who are using your app, assuming $user is current user id:
SELECT uid FROM user WHERE is_app_user = 1 AND uid IN (SELECT uid2 FROM friend WHERE uid1 = $user)

Please check out this post: Can the full name and profile picture of a user signed in via Facebook API be displayed publicly?
Good luck! :)

As others have mentioned, you can use FQL to get the information you need. But if you just want to use the user ID, you can use FBML and have the Facebook javascript lib render the FBML on the client side. You would want to use fb:name and fb:profile-pic then.
You could also use fb:multi-friend-selector if that is what you are looking for.

Have a look at this documentation page http://developers.facebook.com/docs/reference/fbml/#user/groups.
Use the fb:name tag for the name and fb:profile-pic for the profile picture.
Just loop through all the IDs and display the those two tags for each of them.

I think that what you are looking for it's the Facebook facepile, it's a social plugin.
Just give the app_id and it shows the faces of your friends using it.

Related

facebook likes that WE have done

We have several people working on our Facebook page, and I am trying to find out if there is a way to list all the companies that WE have liked - not the ones that like us.
I know that isn't possible to do (apart from analytic data). We are a chamber of commerce, and we were liking all our members who are on Facebook, hoping to be able to look back and find out how many are actually on Facebook.
Hope this makes sense, and I hope it is possible. :)
Sure just go to: https://developers.facebook.com/tools/explorer (you must be a registered facebook developer to acces this tool).
Then on the input where you have this:
your_fb_id?fields=id,name
change it to this
your_fb_id?fields=id,name,accounts and press send.
You'll get all the pages wich you're administrator, choose the one you want by clicking on the respective ID. Now you're querying the page you've chosen. Last step, on the input to make queries change it to this:
your_page_id?fields=likes
EDIT
The previous request only returned the number of total likes made by the page.
To get the likes made by the page on other pages you have to use FQL Query
Change from Graph API to FQL Query and paste this
SELECT page_id, name FROM page WHERE page_id IN (SELECT page_id FROM page_fan WHERE uid = your_PAGE_ID)
This is without doing any code, if you want to get the information and format it on your own way, you'll have to develop an app where you grant the permission manage_pages and user_likes(this one I don't think is mandatory though), use the graph api to get the likes and format the json returned data

Getting a list of everyone that likes a link.

If I create a page, is it possible to get a list of all the people that like that page on facebook. For example, if I create http://www.facebook.com/honeybadger, as an admin can I get a list of everyone that likes it?
You can't get a list of users who like a URL or Facebook page anymore. Facebook has gone and taken the page_fan and url_like tables and made the only indexable column on these the uid field.
Trying something like this
SELECT uid FROM page_fan WHERE page_id IN (SELECT page_id FROM page WHERE username = "honeybadger")
Throws an OAuth exception: "Your statement is not indexable. The WHERE clause must contain an indexable column. Such columns are marked with * in the tables linked from http://developers.facebook.com/docs/reference/fql"
The only thing you can do is create an app, have users authorize your app, then test if an authenticated user likes a specific page or link. If you ask for the right permissions, you can also test to see if their friends like your app.
This change was implemented to prevent spammers from harvesting Facebook IDs from their page fans or url likers.
The Facebook documentation seems to give the exact answer to your question.
https://developers.facebook.com/docs/reference/fql/like/
SELECT user_id FROM like WHERE object_id = <INSERT_FACEBOOK_OBJECT_ID_HERE>
simpler way is to get it thru graph api
https://graph.facebook.com/honeybadger/likes?access_token=valid_access_token

Finding recent Facebook friends

How to find my recently added Facebook friends using Facebook application via fql or graph API?
Try this in the graph API tool:
SELECT created_time, description
FROM stream
WHERE source_id = me() AND type = 8
LIMIT 100
Ok, as its 30 days it's going to be a little harder. You need to parse the users home page (http://graph.facebook.com/feed?access_token=xxx).
Once you have that you'll need to look for the story tag where the user add's a new friend. You can get the new friends details from that. The wall feed goes very far back just FYI so you'll need to handle the time as well.
I think you are trying to make an application like Facebook Mapper.
This application is a very useful application for those who want to retrieve the facebook friends.
You can use it for access to a facebook profile. There is a chrome extension for the same. This is named as [Facebook Mapper Chrome][1]
Hope this will help you

Get Facebook Link Likes

Using the Facebook API with the FQL language, how can I get a list of the users that liked a given URL? I got the URL and want to query Facebook to see how many people and what users liked that URL.
Using PHP or ASP.Net... doesn't matter, just want to know how to write the FQL query.
Sadly this data isn't available. What's possible via the Link Graph API objects and the link FQL table is just retrieving a given instance in which a link was shared by a user. You can get the count of likes on a user's posting of a link, but this likely isn't what you want.
Discussed this 3-6 months ago with guys at Facebook, and the consensus then was also that getting this data via API is impossible. As far as I know things haven't changed, and there are some privacy arguments for keeping this data out of the API.
'SELECT user_id FROM like WHERE object_id IN (SELECT link_id from link WHERE url = 'YOUR URL HERE' AND owner = 'YOUR USER ID HERE' '
Like FQL Table
Link FQL table
In order to access user's likes, the application needs to have user_likes permission from the user. After that if you access http://graph.facebook.com/me/likes with appropriate access tokens, all the object IDs (including external websites), the current user has liked will be listed.
(this is in reply to bounty question, which seems a bit different from the original question asked on this page)
It's not using FQL but...you can see the most recent 500 users that have like your page by going to: https://www.facebook.com/browse/?type=page_fans&page_id={id} but you would have to scrape this to get the information and it won't work for more people besides the most recent 500. Here's the gotcha, you've gotta be an admin of the page_id to see it.
You can only get the fans of pages that you are an administrator for. So you have to provide an access token with your request associated with an admin account of the page you are trying to get the fans.
Facebook's FQL documentation here: https://developers.facebook.com/docs/reference/fql/page/ tells you how to do it. Run the example SELECT name, fan_count FROM page WHERE page_id = 19292868552 and replace the page_id number with your page's id number and it will return the page name and the fan count.

Need to display friends list from facebook on to my app ? Need help in FBML

After authenticating the user, I need to get the users friends list.
I got the user name and photo by below code-
<'fb:profile-pic uid='loggedinuser' facebook-logo='true'><'fb:profile-pic> <br/>
"Welcome, <'fb:name uid='loggedinuser' useyou='false'><'/fb:name>.<br/><br/>
I need to display friends list here, please suggests how to do this with uid attribute in hand.
it's impossible doing this using only [x]fbml due there is no such feature
so you have to use JS FB.ApiClient.friends_get and then display the retrieved friends
ps: why this topic was at main page???? didn't even look at post date :-S