You are here

function fb_form_friend_options in Drupal for Facebook 7.3

Same name and namespace in other branches
  1. 5.2 fb_form.module \fb_form_friend_options()
  2. 5 fb_form.module \fb_form_friend_options()
  3. 6.3 fb_form.module \fb_form_friend_options()
  4. 6.2 fb_form.module \fb_form_friend_options()

File

./fb_form.module, line 148
This module defines facebook-specific form elements for use with Drupal's form API.

Code

function fb_form_friend_options($fbu) {
  global $_fb;
  $items = array();
  if ($_fb) {
    $query = "SELECT last_name, first_name, uid, pic_square FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1={$fbu})";

    // FQL not SQL, no {curly_brackets}!
    $result = fb_fql_query($_fb, $query);

    // TODO: sort results by name
    foreach ($result as $data) {
      $items[$data['uid']] = $data['first_name'] . ' ' . $data['last_name'];
    }
  }
  return $items;
}