You are here

class fb_views_handler_author_is_friend in Drupal for Facebook 6.2

Same name and namespace in other branches
  1. 6.3 fb_views/fb_views_handler_author_is_friend.inc \fb_views_handler_author_is_friend
  2. 7.3 fb_views/fb_views_handler_author_is_friend.inc \fb_views_handler_author_is_friend

@file Handler definition for limiting results to friends.

Hierarchy

Expanded class hierarchy of fb_views_handler_author_is_friend

1 string reference to 'fb_views_handler_author_is_friend'
fb_views_views_data in fb_views/fb_views.module

File

fb_views/fb_views_handler_author_is_friend.inc, line 8
Handler definition for limiting results to friends.

View source
class fb_views_handler_author_is_friend extends views_handler_argument_user_uid {
  function get_default_argument($raw = FALSE) {
    return $GLOBALS['user']->uid;
  }
  function query() {

    //dpm($this, 'fb_views_handler_author_is_friend->query');
    $fb_app = $GLOBALS['_fb_app'];

    // Set on Canvas and Connect pages.
    $uid = $this->argument;
    if ($fb_app && $uid) {
      $fbu = fb_get_fbu($uid, $fb_app);
      if ($fbu) {
        $friends = fb_get_friends($fbu, $fb_app);
        if (is_array($friends) && count($friends)) {
          $this
            ->ensure_my_table();
          $this->query
            ->add_where(0, 'fb_user_app.fbu IN (%s)', implode(',', $friends));
        }
      }
    }
  }

}

Members