function fb_form_friend_options in Drupal for Facebook 5
Same name and namespace in other branches
- 5.2 fb_form.module \fb_form_friend_options()
- 6.3 fb_form.module \fb_form_friend_options()
- 6.2 fb_form.module \fb_form_friend_options()
- 7.3 fb_form.module \fb_form_friend_options()
File
- ./
fb_form.module, line 252 - 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;
}