You are here

function fb_form_group_member_options in Drupal for Facebook 5

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

File

./fb_form.module, line 268
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;
}