function fb_form_group_member_options in Drupal for Facebook 5.2
Same name and namespace in other branches
- 5 fb_form.module \fb_form_group_member_options()
- 6.3 fb_form.module \fb_form_group_member_options()
- 6.2 fb_form.module \fb_form_group_member_options()
- 7.3 fb_form.module \fb_form_group_member_options()
File
- ./
fb_form.module, line 273 - This module defines facebook-specific form elements for use with Drupal's form API.
Code
function fb_form_group_member_options($fbg, $fbu) {
global $fb;
$query = "SELECT uid FROM group_member WHERE gid={$fbg}";
$result = $fb->api_client
->fql_query($query);
drupal_set_message("fb_form_group_member_options({$fbg}, {$fbu}) query {$query} returns" . dpr($result, 1));
$query = "SELECT uid, first_name, last_name FROM user WHERE uid IN (SELECT uid FROM group_member WHERE gid={$fbg})";
$result = $fb->api_client
->fql_query($query);
drupal_set_message("fb_form_group_member_options({$fbg}, {$fbu}) query {$query} returns" . dpr($result, 1));
// TODO: sort results by name
$options = array();
foreach ($result as $data) {
if ($data['uid'] != $fbu) {
$options[$data['uid']] = $data['first_name'] . ' ' . $data['last_name'];
}
}
return $options;
}