In this video I’ll show you how to select which group fields are visible to members based on that group's roles.
Enable Module
- Go to "Modules" (admin/modules) and enable:
- Organic Groups Field Access
- (Save Configuration)
Configure Permissions
By simply enabling this module, no one is able to see fields in any group. If I switch over to safari, and go to “Group #3”, you'll notice that Chelsea can no longer see the body field and if she tries to create a new article, the only visible field is the title field. So let's go ahead and configure these new permissions.
- Go to "Configuration => Organic Groups => OG permissions overview" (admin/config/group/permissions)
- Click "edit" next to Node-Group
- Scroll down to the section labeled: "Organic groups field access"
- View Body Field: Select Non-Member and Member (These act like the “anonymous user” and “authenticated user” global roles so that we don’t need to select any of our custom roles. They’re automatically included in “Member”.)
- Edit Body field: Select Content Creator and Content Moderator
- (Save permissions)
Switch back to safari and go back to “Group #3”. Now we see that Chelsea can view the body field.
Go back to the Administrator's account and configure additional permissions:
- View Groups audience field: Select Non-Member and Member (This will let them see which group(s) a piece of content was posted to.)
- Edit Groups audience field: Select Content Creator and Content Moderator. (This let’s them edit the field. However, on this site, that’s disabled, so it just lets them see the disabled field.)
- View Tags field: Select Non-Member and Member (This is only an option because I have content types that use this field. You’ll have an option for each field in all of your group content content types.)
- Edit Tags field: Select Content Creator and Content Moderator (Same as above)
- View Image field: (Same as Tags field)
- Edit Image field: (Same as Tags field)
- View Group content visibility field: Select Member (This will show whether the article is private or public. We don’t need to show this to Non-Members because the only content they’re able to see is public. Members might need to know if something is private though. For example, if they want to share an article with a friend, this will tell them that the article is public or private since the other person may not be a member, and would only be able to see public articles.)
- Edit Group content visibility field: Content Moderator (You may also want to select “Content Creator”, but this can be used in an advanced way by only selecting “Content Moderator”. In this setup, content will always be created using the group default visibility (public in public groups, and private in private groups). But a content moderator could then go back and change a private post to a public one, if the content is worthy of it.)
- View Group field: Select Non-Member and Member (This lets them view the subscribe/unsubscribe link, so both will need access to this field.)
- Edit Group field: (I won’t select anything here, but you could always enable this for Administrator Member.)
- View Group visibility field: (I’m not actually displaying this field, but you could select this for “Member” so that they know if the group is private or public, just like on group content.)
- Edit Group visibility field: (Same as above)
- View Group roles and permissions field: ( I’m not displaying this field, and in fact, when I tried it, nothing displayed anyway.)
- Edit Group roles and permissions field: (Same as above)
- View Group membership field: Select Member (This is actually a field on the user profile that lists which groups the user is a member of. It’s only useful to members.)
- Edit Group membership field: (I couldn’t think of a practical use for this permission, and think that it’s just programmatically created. If you know something I don’t, please contact me and let me know!)
- (Save permissions)
Now let's have Chelsea create another article to check our settings
* Go to "Group #3 (Public)"
* Click "Article" link under “Content create links”
* Title: Article #9
* Body: (Lorem Ipsum)
* Groups audience: Group #3 (Public)
* (Save)
One huge caveat: Groups that were overriding the default permissions before you enable OG Field Access will have all field access permissions disabled. This means that even though Chelsea is a member of "Group #2(Private)", she can't see any of the group fields.
If we go to "Group #2 (Private)" > Click the "Group" tab > Then click "Permissions"
We see that all of the boxes under "Organic groups field access" are un-checked. Each group that was set to override the default roles and permissions before enabling the "Organic groups field access" module, will need to be edited to allow users to access the various fields. So, if you’re planning on utilizing field access, it’s best to configure it at the beginning of using Organic Groups.
In the next video, I will show you how to add a group type that will have its own global permissions, fields, and content types different from our “Group” content type.