You are here

public function RelationsActivity::viewsQueryAlter in Heartbeat 7

Function to add a part of a sql to a query built by views.

Parameters

object $view: The view handler object by reference to add our part to the query

Overrides HeartbeatStream::viewsQueryAlter

File

modules/heartbeat_defaults/streams/relationsactivity.inc, line 49
User relations activity object.

Class

RelationsActivity
Class RelationsActivity Concrete class to build a stream with activity messages for all users that are connected to the viewed user.

Code

public function viewsQueryAlter(&$view) {

  // This stream is limited to the messages owned by the "viewed" user
  // and his/her relations (friends, fans, ...).
  $query = $view->query;
  $query
    ->add_where(0, "access", HEARTBEAT_PUBLIC_TO_ADDRESSEE, ">=");
  $query
    ->add_where(0, "uid", $this->viewed->relations, 'IN');
}