Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Yes, you can get a list of friends for each user. Here is how I would do it.</p> <p>At registration, if a user registers with Facebook, you store their ID in the database.</p> <p>When an authenticated user views one of your records, issue this FQL query via the API:</p> <pre><code>SELECT uid, name, pic_square, mutual_friend_count FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND is_app_user ORDER BY mutual_friend_count DESC </code></pre> <p>This will give you back other users of your app who are friends with the current user ordered by the mutual friend count between your app user and each friend (assuming closer friends have greater numbers of mutual friends).</p> <p>You can compare this list against any other metric in your database by comparing the result of this query with the stored Facebook ids in your db.</p> <p>Showing friends of friends is a trickier proposition. If you try this query:</p> <pre><code>SELECT uid2 FROM friend WHERE uid1 IN (SELECT uid2 FROM friend WHERE uid1 = me() LIMIT 1) </code></pre> <p>It throws a permission error. Facebook doesn't let you get friends of friends.</p> <p>If it's important to your app, you could get around this by caching each of your app user's most recent friend list each time they login (or on a schedule if you also asked for an extended access token), and querying this table to see if there are friends in common with all the user's friends. You'll need to take a close look at the TOS to see how legal this is.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload