Note that there are some explanatory texts on larger screens.

plurals
  1. POFacebook App Users List
    text
    copied!<p>I am fairly new to the Facebook APIs. I want to get a list of my friends who have also installed my app. (The idea being you can then start a game with them).</p> <p>This gives a list of my friends:</p> <pre class="lang-js prettyprint-override"><code>FB.api('/me/friends', ... </code></pre> <p>This gives my app info:</p> <pre class="lang-js prettyprint-override"><code>FB.api('/myappid', ... </code></pre> <p>What I want is "my friends who also have this app installed"</p> <p>I thought it might be this:</p> <pre class="lang-js prettyprint-override"><code>FB.api('/myappid/accounts', ... </code></pre> <p>I was hoping that would at least give me my Developers, Administrators or Testers, but no such luck. <a href="http://developers.facebook.com/docs/test_users/" rel="nofollow noreferrer">http://developers.facebook.com/docs/test_users/</a> <a href="http://developers.facebook.com/docs/ApplicationSecurity/" rel="nofollow noreferrer">http://developers.facebook.com/docs/ApplicationSecurity/</a></p> <p>My feeling is perhaps I have to use FQL to construst a query that says something like</p> <pre class="lang-sql prettyprint-override"><code>(psuedocode) SELECT FROM my_friends WHERE uid IN ( SELECT uid FROM app_users WHERE appid = myappid ) </code></pre> <p>Any advice would be greatly appreciated.</p> <p>Note, I have seen this post: <a href="https://stackoverflow.com/questions/2932696/facebook-app-retrieve-list-of-ids-of-my-applications-users">FaceBook app: retrieve list of ids of my application&#39;s users</a></p> <p>I am keeping a local list of Facebook User's IDs that belong to my site, and I am actually able to achieve my goal by doing the following, but I am sure there must be a better way:</p> <pre class="lang-php prettyprint-override"><code>$facebookFriendIds = array(); $friends = $this-&gt;facebook-&gt;api('/me/friends'); foreach ($friends['data'] as $friend) { $facebookFriendIds[] = $friend['id']; } $this-&gt;friends = Doctrine_Core::getTable('User')-&gt;createQuery() -&gt;whereIn('fb_user_id', $facebookFriendIds) -&gt;execute(); </code></pre>
 

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