Before we dive into the more advanced ways to post content I want to explain the way content works, in private and public groups, out of the box. In the following videos, we’re going to add the “Group content visibility” field to Articles. This will allow content creators to choose whether the article should be private or public. Many sites, however, don’t need the additional flexibility (and complexity) that this provides, and can simply do without. So, I encourage you to watch this video to decide whether your site actually requires that flexibility.

If you would like to have all content posted to private groups be private, and all content posted to public groups be public, you don’t need to do anything further. That is how group content works by default (with one caveat). Let me demonstrate.

Note: Before we begin, I’ll create a new user named “Chelsea”.

Content posted to public groups

Now that we’ve added the “Group visibility” field, let’s define “Group #1” as a public group.

  • Edit “Group #1”
  • Rename the title to “Group #1 (Public)”
  • Group visibility: Public
  • Rename the menu link title to “Group #1 (Public)”
  • (Save)

Content that is posted to public groups is public by default. If we click “Group #1 (Public)” and go to the group page, we’ll see “Article #1” and Article #2” inside that group. If we switch over to Safari, and go into “Group #1 (Public)”, we’ll see that anonymous users can also see the content of “Group #1 (Public)”.

Content posted to private groups

Now, let’s add an article to our private group.

  • Go to “Group #2 (Private)”
  • Click “Article”
  • Title: Article #3 (In private group)
  • Body: (Lorem Ipsum)
  • Groups Audience: Group #2 (Private)
  • (Save)

Now, we see the article inside “Group #2 (Private)”, and if we go home, we can still see it. If we switch over to safari, and refresh, we don’t see it, because it’s posted to a private group, so it is a private article.

If we add Chelsea to “Group #2 (Private)”, then login as Chelsea, she’ll see the article on the homepage, and inside “Group #2 (Private)”.

Content posted to both public and private groups

The only special case in all of this is when a piece of content is posted to both a private and a public group. In this case, users will not see the content unless they are a member of one of the groups, even if it’s posted to a public group. This is easier shown than explained.

  • Go to “Content => Add Content => Article” (node/add/article)
  • Title: Article #4 (posted to both private and public groups)
  • Body: (Lorem Ipsum)
  • Groups Audience: Choose both “Group #1 (Public)” and “Group #2 (Private)”
  • (Save)

Now, we can see the article in both “Group #1 (Public)” and “Group #2 (Private)”. Chelsea can also see it because she is a member of one of the groups. Let’s have Chelsea unsubscribe from “Group #2 (Private)” by clicking the “Unsubscribe from group” link.

Now, she sees an “Access denied” page because she is no longer a member of the private group. If she clicks the “Group #1” tab, she also no longer sees “Article #4” because she isn’t a member of either group. Let’s add her to “Group #1 (Public)”.

Now, when she refreshes “Group #1”, she sees “Article #4” because she is a member of the group.

Before we continue, I’ll have Chelsea unsubscribe from “Group #1”.

Recap

Okay, so, to recap:
* Content posted to public groups are public
* Content posted to private groups are private
* Content posted to both public and private groups are private, and only visible to members of one of the groups (even on the public group’s page).