Guest User

Untitled

a guest
May 23rd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. function get_connected_friends($user) {
  2. $results = array();
  3. $query = 'SELECT uid, email_hashes, has_added_app FROM user WHERE uid IN '.
  4. '(SELECT uid2 FROM friend WHERE uid1 = '.$user->fb_uid.')';
  5. try {
  6. $rows = facebook_client()->api_client->fql_query($query);
  7.  
  8. // Do filtering in PHP because the FQL doesn't allow it (yet)
  9. if (!empty($rows)) {
  10. foreach ($rows as $row) {
  11. if ((is_array($row['email_hashes']) && count($row['email_hashes']) > 0) ||
  12. ($row['has_added_app'] == 1)) {
  13. unset($row['has_added_app']);
  14. $results[] = $row;
  15. }
  16. }
  17. }
  18. }
  19. catch (Exception $e) {
  20. error_log("Failure in the api: ". $e->getMessage());
  21. }
  22.  
  23. return $results;
  24. }
Add Comment
Please, Sign In to add comment