Basic Configuration

Last updated on
18 October 2024

-- Work in progress --

Please feel free to edit and add to, or clarify and expand where needed. 

This is an extension of the D7 Group Getting started guide, updated for Drupal 8.

Use case: As part of an online RPG, I am creating different factions (groups) where different users can interact with members of the same faction, and access group-specific content. This is the example use case I will use for the following Group module set up.

Download and install Group module. 

Group module install screen
Group module install screen

The Group menu item now appears in your menu bar [/admin/group]. This is the main overview for administering Group, and where new functionality will appear when you activate more submodules.

Group module menu item in admin interface
Group module menu item in admin interface

Group module menu item in sidebar admin interface
Group module menu item in sidebar admin interface

The first step (like adding content to Drupal) is to create our Group type. Only then can we create specific groups.

Group types [ admin/group/type ]

Group module group types screen
Group module group types screen

Group module add group type form
Group module add group type form

Group Type Display 

Much like Content types, we can add fields, and control their display. For my example, I will add a description field, an image field and an entity reference field for a taxonomy.

Group module add fields to group type
Group module add fields to group type

Group module manage form display for group type
Group module manage form display for group type

Group module manage display for group type
Group module manage display for group type

Note the absence of Custom display settings on the Manage Display tab. To add a custom display mode, we first create one [ admin/structure/display-modes/view ]

Add a custom display mode (optional)

Go to Structure/display-mode/view and click "+ Add View mode" at the top of the page. 

Group module manage display for group type
Group module manage display for group type

Group module manage display for group type
Group module manage display for group type

It is also worth noting the other Group Type Operations, accessible from the Group Type list page.

Group module group type operations
Group module group type operations

Creating Groups

We can now create our individual groups. In my example, I am setting these up as the admin user. I will be adding two factions - Cyberians and Fantasians. Each faction will have a leader and multiple members.

Group module add group screen
Group module add group screen

Group module add group form with fields
Group module add group form with fields

Group module list of groups
Group module list of groups

Now, when we visit group/ID, we should see the Group's page, and the fields we've set to display.

Group module front-end group view logged in as admin
Group module front-end group view logged in as admin

Adding Roles to Group Types

We can add a multiple roles for each group type, and configure their permissions to suit our scenario.

In my case, group pages will be visible to everyone (anonymous), but members pages can only be accessed by members of the same group ("member" role, in the Group module's terminology).

Leaders have some group administrator permissions, like adding members and editing the group.

Group module add role to group type
Group module add role to group type

Group module role permission example for member
Group module role permission example for member

Group module role permission example for leader
Group module role permission example for leader

Group module group type role permissions
Group module group type role permissions

Adding Users to Groups

Next, we want to focus on the users. I have created a few dummy users for this example.

Group module global user list
Group module global user list

As admin, I can assign an existing user the role of Faction leader.  

TO DO - add path

Group module admin add user and assign role 'leader'
Group module admin add user and assign role 'leader'

Next I will log in as the faction leader user, and add members to the faction. [ group/ID/members > Add member ]

Group module leader add user and assign role 'member'
Group module leader add user and assign role 'member'

When we return to the Group homepage, we can see the list of group members.

Group module group's member list
Group module group's member list

To test the permissions, I can log in as the "member" role for each group, and the "leader" role, and compare the different displays.

Below are screenshot of what the "leader" role sees when on the group page, and what the "member" role sees. Note the absence of the Tabs (View/Edit/Delete/Related entities/Members) in the latter.

Group module group page with edit access
Group module group page with edit access

Group module group page with edit acecss
Group module group page with view acsess

Adding Content to a Group

To see what content is available via a group type, go to Set available content in Group Type Operations.

Group module group type set available content
Group module group type set available content

There is a separate module that needs to be enabled called Group Node. It comes as part of the Group module.

Without it, we won't see any reference to Group Node content when we go to configure the content. 

Group module content operations without node plugin
Group module content operations without Node plugin

Enabling the Group Node module triggers a message to rebuild content access permissions.

Group module Group node enable
Group module Group node enable

Group module content operations without node plugin
Group module content operations without node plugin

Group module content operations with node plugin
Group module content operations with node plugin

Group module after Group node (Article) has been enabled
Group module after Group node (Article) has been enabled by clicking on "Install" for Group node (Article)

Now, grant the Faction Member permission to access the Group node overview, create and edit own Articles at Administration > Groups > Group types > Edit Faction > Permissions

Group module set permissions for Faction members
Group module set permissions for Faction members

Log in as a Faction member, and check that the user has access to the group node overview, and can create end edit Articles.

Faction member can access Overview and create and edit Articles
Faction member can access Overview and create and edit Articles

TO DO

  1. View modes per Group content type
  2. Template overrides

Help improve this page

Page status: No known problems

You can: