The Facebook API gives you the option of using FQL (Facebook Query Language) to retrieve data instead of using the built in API calls. I thought this was unnecessary until I needed a quick query to get me the list of a users friends with the current application added. After some research, I came across the following query:

$facebook->api_client->fql_query("SELECT uid FROM user WHERE has_added_app=1 and uid IN (SELECT uid2 FROM friend WHERE uid1 = $user)");

This returns a nice quick list I can use in the multi-friend selector for excluded IDs in the ‘share’ part of the application as well as a quick number for how many friends have already added the application. This can be very useful.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • ThisNext
  • MisterWong
  • Wists

4 Comments

Leave a Reply