You are here

function oa_core_get_membership_nodes in Open Atrium Core 7.2

Helper to get membership nids for a group.

Parameters

int $nid: The nid of the group to find og_membership nodes.

bool $loaded: Whether to return just the nids or fully loaded nodes.

Return value

array The og_membership nids or fully loaded node objects.

2 calls to oa_core_get_membership_nodes()
oa_core_update_7236 in ./oa_core.install
Update Group and Space node access grants.
_oa_core_update_access_records_batch in includes/oa_core.access.inc
Batch for updating node access records.

File

includes/oa_core.util.inc, line 1060
Code for Utility functions for OpenAtrium spaces

Code

function oa_core_get_membership_nodes($nid, $loaded = FALSE) {
  $nids = db_select('og_membership', 'og')
    ->fields('og', array(
    'etid',
  ))
    ->condition('og.entity_type', 'node')
    ->condition('og.gid', $nid)
    ->condition('og.field_name', OG_AUDIENCE_FIELD)
    ->execute()
    ->fetchCol(0);
  if ($loaded) {
    return node_load_multiple($nids);
  }
  else {
    return $nids;
  }
}