src/Security/Member.php
public static function map_in_groups($groups = null)
    {
        $groupIDList = array();

        if ($groups instanceof SS_List) {
            foreach ($groups as $group) {
                $groupIDList[] = $group->ID;
            }
        } elseif (is_array($groups)) {
            $groupIDList = $groups;
        } elseif ($groups) {
            $groupIDList[] = $groups;
        }

        // No groups, return all Members
        if (!$groupIDList) {
            return static::get()->sort(array('Surname' => 'ASC', 'FirstName' => 'ASC'))->map();
        }

        $membersList = new ArrayList();
        // This is a bit ineffective, but follow the ORM style
        /** @var Group $group */
        foreach (Group::get()->byIDs($groupIDList) as $group) {
            $membersList->merge($group->Members());
        }

        $membersList->removeDuplicates('ID');

        return $membersList->map();
    }
public static function map_in_groups($groups = null)
    {
        $groupIDList = array();

        if ($groups instanceof SS_List) {
            foreach ($groups as $group) {
                $groupIDList[] = $group->ID;
            }
        } elseif (is_array($groups)) {
            $groupIDList = $groups;
        } elseif ($groups) {
            $groupIDList[] = $groups;
        }

        // No groups, return all Members
        if (!$groupIDList) {
            return static::get()->sort(array('Surname' => 'ASC', 'FirstName' => 'ASC'))->map();
        }

        $membersList = new ArrayList();
        // This is a bit ineffective, but follow the ORM style
        /** @var Group $group */
        foreach (Group::get()->byIDs($groupIDList) as $group) {
            $membersList->merge($group->Members());
        }

        $membersList->removeDuplicates('ID');

        return $membersList->map();
    }
public static function map_in_groups ( $ groups = null ) { $ groupIDList = array ( ) ; if ( $ groups instanceof SS_List ) { foreach ( $ groups as $ group ) { $ groupIDList [ ] = $ group -> ID ; } } elseif ( is_array ( $ groups ) ) { $ groupIDList = $ groups ; } elseif ( $ groups ) { $ groupIDList [ ] = $ groups ; } // No groups, return all Members if ( ! $ groupIDList ) { return static :: get ( ) -> sort ( array ( 'Surname' => 'ASC' , 'FirstName' => 'ASC' ) ) -> map ( ) ; } $ membersList = new ArrayList ( ) ; // This is a bit ineffective, but follow the ORM style /** @var Group $group */ foreach ( Group :: get ( ) -> byIDs ( $ groupIDList ) as $ group ) { $ membersList -> merge ( $ group -> Members ( ) ) ; } $ membersList -> removeDuplicates ( 'ID' ) ; return $ membersList -> map ( ) ; }
Get a member SQLMap of members in specific groups

If no $groups is passed, all members will be returned

@param mixed $groups - takes a SS_List, an array or a single Group.ID
@return Map Returns an Map that returns all Member data.
Get a member SQLMap of members in specific groups