I am using OG, Flag and Rules module. I would like to do like this.

When a user click Flag links in Group (name is follow_group) then all group content of that group will be flagged as following.

For now, i'm stuck at getting all group content of specific group. Is there a way to get group content of current group?


1 Answer 1


All the contents are associated in og_membership table. If you can get the gid (group node id), then it will be easier to get the content associated with that group.

$og_contents = db_select('og_membership', 'ogm')
->fields('ogm', array('etid'))
->condition('ogm.gid', $gid, '=')
->condition('ogm.entity_type', 'node', '=')
  • Cool, it worked. Sep 29, 2015 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.