You are here

class fb_views_handler_filter_friends in Drupal for Facebook 6.3

Same name and namespace in other branches
  1. 6.2 fb_views/fb_views_handler_filter_friends.inc \fb_views_handler_filter_friends
  2. 7.3 fb_views/fb_views_handler_filter_friends.inc \fb_views_handler_filter_friends

@file Filter handler for friends of the current user

Hierarchy

Expanded class hierarchy of fb_views_handler_filter_friends

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

File

fb_views/fb_views_handler_filter_friends.inc, line 6
Filter handler for friends of the current user

View source
class fb_views_handler_filter_friends extends views_handler_filter_boolean_operator {
  function construct() {
    parent::construct();
    $this->value_value = t('Is friend of the current user');
  }
  function query() {

    // We can't learn friends if user is not logged in.
    $fbu = fb_facebook_user();
    if ($fbu) {
      $friends = fb_get_friends($fbu);
    }
    if (!$fbu || !count($friends)) {

      // Hide all content
      $friends = array(
        0,
      );
    }
    $this
      ->ensure_my_table();
    $this->query
      ->add_where(0, $this->table_alias . '.fbu IN (%s)', implode(',', $friends));
  }

}

Members