You are here

function fb_form_group_member_options in Drupal for Facebook 7.3

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

File

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

  // FQL not SQL, no {curly_brackets}!
  $result = fb_fql_query($_fb, $query);
  $query = "SELECT uid, first_name, last_name FROM user WHERE uid IN (SELECT uid FROM group_member WHERE gid={$fbg})";

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

  // 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;
}