function fb_views_handler_filter_friends::query in Drupal for Facebook 7.3
Same name and namespace in other branches
- 6.3 fb_views/fb_views_handler_filter_friends.inc \fb_views_handler_filter_friends::query()
- 6.2 fb_views/fb_views_handler_filter_friends.inc \fb_views_handler_filter_friends::query()
Add this filter to the query.
Due to the nature of fapi, the value and the operator have an unintended level of indirection. You will find them in $this->operator and $this->value respectively.
Overrides views_handler_filter_boolean_operator::query
File
- fb_views/
fb_views_handler_filter_friends.inc, line 12 - Filter handler for friends of the current user
Class
- fb_views_handler_filter_friends
- @file Filter handler for friends of the current user
Code
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));
}