You are here

function fb_form_friend_options in Drupal for Facebook 5.2

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

File

./fb_form.module, line 257
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})";
    $result = $fb->api_client
      ->fql_query($query);

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