[Facebooker-talk] How do you find user's friends that have installed your app?
Nnanna Obuba
nobuba at gmail.com
Wed Feb 4 07:58:45 EST 2009
Thanks. for anyone who is interested, here's the syntax as I used it
to return an array of uids for friends of the current user who have
installed your app
1. Using the facebooker method
@current_users =
current_user.facebook_session.user.friends_with_this_app.map {|x| x.uid}
2. Using FQL
already_in = current_user.facebook_session.fql_query(
"SELECT uid FROM user WHERE uid IN (SELECT uid2 FROM
friend WHERE uid1= #{current_user.facebook_id} ) AND is_app_user")
@current_users = already_in.map {|y| y.uid}
Of course if you want the user objects instead of the uids you can
just remove the map stuff at the end
Hope it makes someone's life easier, like Aurelien's post made mine
Nnanna
On Feb 4, 2009, at 1:40 AM, Malisart Aurélien wrote:
> Hi,
>
> There is a "friends_with_this_app" method inside Facebooker::User.
> So you need to call it on the current facebooker user:
>
> facebook_session.user.friends_with_this_app
>
> Hope it helps.
>
> Aurélien
>
More information about the Facebooker-talk
mailing list