I want all the nodes of content type 'Site Address' attached to a group. I have written the following code. It doesn't seem to work.

$query = db_select('node', 'n')
        ->condition('n.status', 1, '=')
        ->fields('n', array('nid')); 
$query->join('og_membership', 'ogm', "ogm.gid = :gid AND n.nid = ogm.etid AND ogm.entity_type = 'node'  ", array(':gid' => $gid));   $result=$query->execute()->fetchAll();

  • mistake in query AND n.nid = ogm.entity_id – Adi Sep 11 '15 at 6:33
  • There is no column named 'entity_id' in 'og_membership' table. – altaf raja Sep 11 '15 at 6:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.