Posted by hetrus on October 23, 2011 at 11:10pm
Hello
On the site (drupal 7) there are the authorized users and groups (organic groups module) consisting of authorized users. There is a content type, I want to display only for group members (but not group content - so the groups could not edit it). How do I check whether a user to a group member (e.g. such as checking for anonymous <? php global $ user; if ($ user-> uid): ?> )? I do not mean checking for a specific group, and in general to an active member of any group. Thanks.
Comments
Solution?
Did you ever figure this out. I am looking for the same.
Provided I've understood your
Provided I've understood your question correctly you're probably looking for functions like og_is_member() and og_get_entity_groups()
og_get_entity_groups() returns a list of group ids that an entity belongs to and og_is_member() returns true/false is an entity is a member of a particular group id, between the two of those you should be able to get what you need.
I'm using them to make sure that the user was a member of the same group as the currently being viewed node in my module - worked like a charm for my needs.