What does selecting "Primary Group" for a user do?

I’ve been trying to work out exactly what selecting a “Primary Group” for a user does…
… thought I would share what I have found:

Selecting the Primary Group

Selecting a user from /admin/users takes you to the specific users admin page /admin/users/{username}.

On that page you will find the groups options:

You can only select a Primary Group for a user if they have “Custom” groups selected.
In the example above Discourse and Test are the only “Custom” groups, the ones left are “Automatic”.

Looking at the Groups section will help you work out which ones are “Custom” and “Automatic”

From the groups page, you can filter by type:

:memo: The automatic groups are: admins, moderators, staff, trust_level_0, trust_level_1, trust_level_2, trust_level_3, trust_level_4 and everyone. These groups are created with every discourse installation and cannot be deleted. They are used for user permissions and other functionalities exclusive of each group. Only staff users can see the automatic groups, with the exception of the moderators group.

What does it do?

Adds CSS class to users posts

If the primary group is called team the CSS class added to topic-post will be group-team.

You could use this to change the post colour based on the users primary group.

Adds title to user’s profile

You can configure a title for the members of a group. From the group’s Manage page, set a Default title:

For this example, we are using the “Discourse” custom group. The user below has their primary group set to Discourse and their title is “member”.

Something important to note is that a user can have multiple titles. For example, if they were awarded a “leader” badge, they will also have the “leader” title. A title awarded from a badge takes precedence over a group title and is the one shown in the card by default. This can be overridden from the user’s preference page:

You can also add a link to the title, see:

Adds an avatar flair

You can configure an avatar flair for all members of a group. Setting the group as primary will show the avatar flair in the user’s card. Instructions on how to configure it can be found here:

How to set a primary group for a user

As mentioned above you can set a user primary group from the user’s admin page at /admin/users/{username}.

You can also check the Automatically set as primary group in the group’s settings:

Enabling this setting, will set the primary group for all new and existing members of the group retrospectively.

:memo: If a user is added to multiple groups that have the Automatically set as primary group setting enabled, their primary group will be the last group they joined.

Group owners can also set (or remove) the group as primary from the group’s Members page:

You can allow users to select their own primary group by enabling the user selected primary groups setting:

Users will be able to choose their primary group from their’s Preferences page.

Missed something?

If there is something you think I have missed please do mention it below.