You are here

function privatemsg_groups_load_multiple in Privatemsg 7.2

Load a number of ogs based on their group ids.

1 string reference to 'privatemsg_groups_load_multiple'
privatemsg_groups_privatemsg_recipient_type_info in privatemsg_groups/privatemsg_groups.module
Implements hook_privatemsg_recipient_type_info().

File

privatemsg_groups/privatemsg_groups.module, line 104
Allows to send messages to all members of an organic group

Code

function privatemsg_groups_load_multiple($gids, $type) {
  $recipients = array();
  $group_type = _privatemsg_groups_get_group_type($type);
  $groups = entity_load($group_type, $gids);
  foreach ($groups as $gid => $group) {
    $recipient = clone $group;
    $recipient->type = $type;
    $recipient->recipient = $gid;
    $recipients[privatemsg_recipient_key($recipient)] = $recipient;
  }
  return $recipients;
}