In this video, I'll show you how to create private and public articles in private groups.
Allowing content to be defined as “private” or “public”
In order to allow content authors to select whether their content should be public or private, we need to head back to the Organic Groups field settings. Select the article bundle, and add the field “Groups content visibility”.
- Go to "Configuration => Organic Groups => OG Field Settings" (admin/config/group/fields)
- Bundle: Article
- Fields: Group content visibility
- (Add field)
Note: the option "Groups audience" enables a content type to be posted to a group, making it group content. This is the second way to accomplish this as mentioned in the first video "Organic Groups Setup." It can be faster to add this field here if you have a number of content types created before you install Organic Groups. While it may be just as fast to add the field like we did in the first video, when creating a new content type.
Creating a private article
- Go to "Add Content => Article" (node/add/article)
- Title: Article #5 (in private group)
- Body: (Lorem Ipsum)
- Groups audience: Choose "Group #2 (Private)"
- Group content visibility: Use group defaults (We have three options. “Use group defaults” will set the article as private if the group is private, and set the article as public if the group is public, just like in the last video. “Public” will set the article as available to all site users even if the group is private. And “Private” will restrict access to only group members, even if the group is a public group.)
- (Save)
Now we see Article #5. However, if we switch over to Safari and go home, we don't see the article, and we can even type in the link directly, and all we'll see is an access denied page.
Creating a public article in a private group
This time, we'll create a public article inside a typically private group
- Go to "Add content => Article" (node/add/article)
- Title: Article #6 (public in private group)
- Body: (Lorem Ipsum)
- Groups audience: Group #2 (Private)
- Group content visibility: Public (This will make the post accessible to anyone (even anonymous users) and should be seen on the front page by anonymous users.)
- (Save)
Now we see Article #6, and if we switch over to Safari and go home, we can still see Article #6. If we click the article and scroll down, we’ll see that the groups audience is simply “- Private group -” because we don’t have access to that group.