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


(Dean Taylor) #1

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 committee_members and full_members_14_15 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”

What does it do?

Adds CSS class to users posts

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

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

Links users “title” to Primary Group

For example the user below has their primary group set to discourse and their title is “co-founder” and “co-founder” links to https://meta.discourse.org/groups/discourse.

This is handy to understand the relationship of a users title to the group they are in - and what other users might be in the group.
Although this linking of user title might change to be a site option.

Also see:

Missed something?

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

What is a Primary Group and how is it different to a non-primary one for a user?
What exactly does "Automatically set as primary group" do?
Could users choose their own primary group?
Avatar Flair (not Badges) for Groups
Create a group that automatically adds associated flair to its members' avatars
(Anton) #2

So, it turns out primary groups are only there for CSS and titles? Nothing else?

(Dean Taylor) #3


A year on - I’ve just completed another quick review of the source code…
… there doesn’t appear to be any additional code using primary_group.

(Mittineague) #4

I’ve done a bit of looking as well, and likewise didn’t find it to be connected to much else.

Perhaps this is in place for some future development that hasn’t happened yet?

I can’t speak for others, but for me the word “Primary” implies significant importance that sets something apart from the rest. Something important that deserves my spending time to understand exactly what effect making it Primary will have.

If this setting is only ever going to affect title display and add a CSS class maybe the copy for the setting should be changed to something more descriptive of what it does?

This older topic looks to have some related discussion re titles.