You are here

public function Group::getMemberCount in Group 7

Get the amount of members in a group.

Return value

int The total amount of group members.

File

classes/group.inc, line 333
Defines the Entity API class for groups.

Class

Group
Main class for groups.

Code

public function getMemberCount() {
  $query = db_select('group_membership', 'gm');
  $query
    ->condition('gm.gid', $this->gid);
  $query
    ->addField('gm', 'uid');
  $query
    ->distinct();
  return $query
    ->countQuery()
    ->execute()
    ->fetchField();
}