Group is an extremely powerful Drupal 8 module that allows you to create groups of users with shared content and permissions.
It's easy to see why this module has replaced Organic Groups, and become the default choice for social sites in Drupal 8.
In this tutorial, I'm going to explain how you can use the new Group module to organize your site's users.
Step #1. Setting up Groups
Here's how to get started:
- Download and enable the Group module. Enable all 3 submodules.
- You will see a message asking you to rebuild the permissions because Group does change the way that the permissions work. Click this link and rebuild the permissions (You will actually see this many times as you configure the Group module. It's not necessary to rebuild permissions every time, however you should when you're configuration is finished).
Now we can start to set up our groups. One key thing to know about Group is that it has a group type feature. This is very similar to the relationship between content types and nodes.
- Click the Groups icon in the admin menu.
- Select the Group types tab:
In this example, we're going to be building a news site with different editor levels. We will be making one group for each team.
- Click "Add group type" and set up the groups, as in the image below:
As with content types, you can create fields for the group types. For example, you could use these fields to create a profile of each team with its logo, location and more.
Step #2. Connect the group types to content
Now we're going to connect our groups to content types. This will allow us to use the Group module for extra permissions. In this example, I'm going to connect the Basic Pages content type to our groups.
- From the Group Types page, go to the "Manage fields" dropdown and choose "Set available content":
- Click "Install" for "Group node (Basic page)".
- You will now see a confirmation screen. Click "Install plugin".
Step #3. Add the groups
Now we can start to add the groups.
- Go to Groups > Add group
- Choose one of the group types you have set up.
- Give the group a name. In this case, I'll call the group "Basic Page Writers".
- Save the page and this will take you to the group summary page. From here you can view the group's details, members, and content.
From this page, you can add some members to test the groups:
- Click the "Members" tab.
- Click "Add member".
- You can now add existing users to this group:
You can also add some content from this main group page.
- Click the "Node" tab.
- Because we choose "Group node (Basic page)" in Step 2, you can now add basic page content to this group by clicking "Create node".
Find out more:
We've only just scratched the surface of the Group module in this tutorial. It's already one of the best modules I've seen for Drupal 8 and it's clearly a very strong option for anyone wanting group functionality. If you have any requests for further Group tutorials, please let us know in the comments.