# Setting a primary group for users

**URL:** https://meta.discourse.org/t/setting-a-primary-group-for-users/25857
**Category:** Site Management
**Tags:** groups, explanation
**Created:** [March 1, 2015, 4:22pm UTC](https://meta.discourse.org/t/setting-a-primary-group-for-users/25857 "2015-03-01T16:22:58Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Discourse](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discourse/32/148734_2.png) [@Discourse](https://meta.discourse.org/u/Discourse)
#### Post date: [March 1, 2015, 4:22pm UTC](https://meta.discourse.org/t/setting-a-primary-group-for-users/25857/1 "2015-03-01T16:22:58Z")

</div>

> 🔖 This guide explains the concept of “Primary Group” in Discourse, detailing what it does and how to set it up.
> 
> 🙋 Required user level: Administrator

## What is a primary group?

A primary group is a custom group that can be assigned to a user as their main group affiliation. This assignment has several visual and functional implications within the Discourse platform.

## Setting a primary group

To set a primary group for a user:

1. Navigate to `/admin/users`
2. Click on the specific user’s name
3. On the user’s admin page (`/admin/users/{userId}/{username}`), locate the groups options
4. Select a “Custom” group as the primary group  
 ![User admin page showing group options](https://global.discourse-cdn.com/meta/original/3X/5/c/5c0d13fb52b9d3e8d42697b1d0e8b8338640181c.png)

> ℹ You can only select a primary group for a user if they belong to “Custom” groups. Automatic groups like `admins`, `moderators`, `staff`, `trust_level_0`, etc., cannot be set as primary groups.

## Effects of setting a primary group

Setting a primary group for a user has several effects:

### 1. Adds CSS class to user’s posts

If the primary group is called `team`, a CSS class `group-team` is added to the user’s posts. This can be used to style posts differently based on the user’s primary group.

 ![Post with CSS class based on primary group](https://global.discourse-cdn.com/meta/original/3X/2/2/223a75c3ffb9317e54033bf6ad7756a1f50e660b.png)

### 2. Adds title to user’s profile

You can configure a title for members of a group:

1. Go to the group’s Manage page
2. Set a Default title  
 ![Setting a default title for a group](https://global.discourse-cdn.com/meta/original/3X/9/a/9aa80777ff10457954deb399e4b1827973bcddf7.png)

This title will appear on the user’s profile:

 ![User profile showing group title](https://global.discourse-cdn.com/meta/original/3X/2/6/269e1bc599ac69c4068b4ce9039aedf65f1cac5f.png)

> ℹ Users can have multiple titles. A group title (especially from the primary group) takes precedence over a badge title. Users can override this in their preferences.

### 3. Adds an avatar flair

You can configure an avatar flair for a group. When the group is set as a user’s primary group, it also becomes their flair group by default, and the flair will appear on the user’s avatar. The flair group can also be set independently from the primary group.

## How to set a primary group

There are several ways to set a primary group:

1. From the user’s admin page at `/admin/users/{userid}/{username}`
2. Enable “Automatically set as primary group” in the group’s settings
3. Group owners can set or remove the group as primary from the group’s Members page
4. Allow users to select their own primary group by enabling the `user selected primary groups` setting

> ℹ 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.

## Bulk removing primary groups

To remove primary groups for multiple users:

1. Create a new group with tight restrictions (admin only) and check “set as primary group”
2. Add all users whose primary group you want to clear to this new group
3. Delete the new group

## Additional resources

- [Linking user titles to groups](https://meta.discourse.org/t/link-user-title-to-a-group/19169)
- [Add group flair on member avatars](https://meta.discourse.org/t/automatically-add-group-flair-to-members-avatars/82700)

> Last edited by @Moin 2024-07-16T06:08:14Z
> 
> > **Check document**
> >
> > Perform check on document:

---

<div class="post-metadata">

### Author: ![Joe\_F](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@Joe\_F](https://meta.discourse.org/u/Joe_F)
#### Post date: [January 24, 2025, 11:04am UTC](https://meta.discourse.org/t/setting-a-primary-group-for-users/25857/15 "2025-01-24T11:04:38Z")

</div>

> [@Discourse](#):
>
> Enable “Automatically set as primary group” in the group’s settings

Has anyone been able to find " 1. Enable “Automatically set as primary group” in the group’s settings"

I cannot find it in my groups settings.

Thanks

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [January 24, 2025, 11:11am UTC](https://meta.discourse.org/t/setting-a-primary-group-for-users/25857/16 "2025-01-24T11:11:57Z")

</div>

It’s here:

 ![The image shows a group management interface with membership and access settings, indicating that users can join or leave the group freely, and email domain matching for automated membership requests. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/b/8/d/b8d9f94e6c196ebe861aa601744e97970fef8625.png)

It’s not available on automatically created groups like staff, trust level groups, etc.

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [January 25, 2025, 9:53am UTC](https://meta.discourse.org/t/setting-a-primary-group-for-users/25857/17 "2025-01-25T09:53:19Z")

</div>

Are you looking to have an Avatar flair for automatic Groups?

If so this #Customization > Theme component can add an additional flair for Trust Levels this is separate from group flairs.

> [@Trust-Level Avatar Flair](https://meta.discourse.org/t/trust-level-avatar-flair/82656):
>
> This theme component allows an admin to add flair to user avatars based on the user’s trust level. Trust level flair displays anywhere on the site that you would normally see group flair. There are a few theme settings to adjust the position of the flair in relation to the avatar. Basic Examples (with group flair in place) There is also a bottom-right position that will either replace group flair or be replaced by group flair depending on how you set the “group flair always on top” …
