You are here

protected function MembersActivity::queryAlter in Heartbeat 7

Implementation of queryAlter().

Overrides HeartbeatStream::queryAlter

File

modules/heartbeat_og/streams/membersactivity.inc, line 78
Defines a stream for Member Activity.

Class

MembersActivity
Concrete class MembersActivity Defines a stream displaying all activity from members in a group.

Code

protected function queryAlter() {
  if (empty($this->og_context->gid)) {
    $this->nid = 0;
    return;
  }
  $members = array();
  $result = db_query("SELECT u.uid FROM {users} u LEFT JOIN {og_membership} om ON u.uid = om.etid AND om.entity_type = 'user' " . "WHERE om.gid = :gid AND u.status <> '0' AND om.state = '1' ", array(
    ':gid' => $this->og_context->gid,
  ));
  foreach ($result as $row) {
    $members[$row->uid] = $row->uid;
  }

  //$this->query->condition('ha.in_group', 0, '<>');
  if (!empty($members)) {
    $this->query
      ->condition('ha.uid', $members, 'IN');
  }
}