Skip to content

Instantly share code, notes, and snippets.

@DuaelFr
Last active December 19, 2015 15:28
Show Gist options
  • Save DuaelFr/5976106 to your computer and use it in GitHub Desktop.
Save DuaelFr/5976106 to your computer and use it in GitHub Desktop.
<?php
/**
* Get all users of a group who contributed.
*/
function _events_resource_get_users_in_group($gid) {
$query = db_select('og_membership', 'ogm');
$query->join('node', 'n', "n.nid = ogm.etid AND ogm.entity_type = 'node'");
$query->join('user', 'u', 'n.uid = u.uid');
$query->fields('n', array('uid'))
->condition('n.status', 1)
->condition('u.status', 1);
$result = $query->execute();
return $result->fetchAll();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment