Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm on Drupal 7 with Organic Groups installed. I've created a Private Group 'Students' and a Private group 'IT-department' The groupmembers of 'Students' are all our students. The groupmembers of 'IT-department' are all the persons of the IT-departement.
When i create content and select as groups audience 'Students' and 'IT-departement'. Then the content is visible for everyone who is member of the group 'Students' OR the group 'IT-department'. Is it possible to do a AND ? So that the content is only visible for who is a member of the group 'Students' AND the group 'IT-department' ?
Comments
Comment #1
Staler75 CreditAttribution: Staler75 commenteddid you find a solution yet? looking at a sort of same situation
Comment #2
nelsonre CreditAttribution: nelsonre commentedIn order to do what you want, you're going to need to write a custom solution. I suggest you look at the og_access module, particularly the og_access_node_access_records, and og_access_node_grants functions to see how it current works, and what you can do about it. I think you're going to need to concatenate group ids to create a single grantid in order to do what you want. So instead of adding each group id that a post belongs to the grants array, you need to just add the concatenation of all the group ids that a post belongs to. That's how I would tackle it. Others might have better ideas.
I would also recommend you look at the docs for hook_access_node_records, and hook_access_node_grants.