You are here

public function Group::getMembersRecursive in Group 7

Get all members of a group, including subgroup members.

Return value

array An array of GroupMembership entities.

File

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

Class

Group
Main class for groups.

Code

public function getMembersRecursive() {
  drupal_set_message(t('Deprecation notice!<br />Group::getMembersRecursive() will soon be removed. Please look towards solutions involving the use of use Group::getMembers() instead.'), 'warning');
  $members = $this
    ->getMembers();
  foreach ($this
    ->getSubgroups() as $subgroup) {
    $members += $subgroup
      ->getMembers();
  }
  return $members;
}