User in multiple groups, title display and group link don't match

I’d say this is a bit of an edge case, not really sure. The root problem seems to be “don’t join 10 groups when you’re only supposed to join one?”

I don’t know if Discourse can enforce the fact that users are only ‘allowed’ to join one of the open groups. There would need to be a group membership quota limit somewhere?

We don’t need anything at enforces a limit on joining groups.

But it’s weird that his title and his primary group don’t match.

It’s also weird that his title doesn’t link to the group name it displays.

The old title was retained from previous group membership, I think.

Definitely retained, but what you see in the screenshots is still current.

My guess is he joined all the groups in alphabetical order. Baboon first so it was set as his primary group. Then the others. Then whale last so it was the last to be applied as the title.

But why does that title link to the primary group instead of the group that set the title?

There is no “on group removal do X” logic, only “on group add do X”. If you add a new group that’s primary, it sets the title – but removing a group doesn’t take any action.

The deeper fix is to enforce a group quota so you can only be a member of X groups, but I’m not sure how many other Discourse instances would need that.

I support adding a “strip title if user leaves primary group and there is an exact match” and “switch title if exact match and primary changes”

Both rules do not exist now and adding them will reduce confusion for sure


I support what @sam is proposing.

We have zero need for or desire for a group quota.

If it comes up again, let us know. I generally don’t like to take actions, particularly actions that involve significant engineering time, based on a single data point.

Do you mean, if I find more users with the same case of a mismatch between the title and where the title links?

That clearly seems like a bug. There’s no way that clicking on a title that says “whale” should take you to any group besides “whale.”

I meant users who erroneously join 10+ groups, then have the “extra” group memberships forcibly revoked by an admin :wink:

I’d still much rather deal with the root cause here rather than the symptoms. Just the engineer in me, I guess.

I just spent time reading through the code.

I can explain how it works now :blush:

  • If you change the default title on a group then all the users with the old title get a new title (Good ™)

  • If you add a title to a group then all users with blank titles will get the title (Good ™)

  • If a user is removed from a group that grants title, title is revoked if it matches (Good ™)

  • If a user is added to a group and has no title, we will grant a title (Good ™)

What we have that is inconsistent and confusing is:

  • If a user is added to a group that has primary group set we will unconditionally set primary group, regardless of what it was previously. This deviates from the “title” behavior.

  • If a group is saved and you “flick” primary group on, off, on. Primary group will be set unconditionally for ALL users regardless of what it was before.

  • If you remove membership from one group and 2 groups grant a title, we will blank out your title, but NOT set it to the other title.

Due to this inconsistency and confusion, for your use case you have to:

  1. Ensure user is only in one group that has “primary group” set

  2. Edit that group, set title to gibberish, save, then change it back… save.

Clearly this is all a bit crazy.

So what we should do here is:

  1. If we strip title, we should check if there is a new title we can grant you.

  2. We should always prefer title to match you current primary group if it grants a title. (So if we have 5 titles to pick from and your title is set to one of the 5 we should pick the right title and not override a custom one)

Those 2 fixes will HEAVILY reduce all the confusion around this. The underlying problem is that there is a relationship between auto title for group and primary group that is not properly captured in code.

Also UI wise it is “Default title” is on one screen, “Automatically set as primary group” is on another screen, this is far from ideal cause these two features are related, also the copy should explain how they are related. (Clicking on the title will take you to primary group if primary group is set)


Thanks @sam. This is great.

I fear I may have confused the issue by trying to be “helpful” with all the context about multiple groups. The issue we’re trying to solve for is the mismatch between the title and where it links.

What you’re outlining really helps.


Sure, these seem like better fixes to me. I just want to treat the actual disease, not the symptoms. Treating symptoms isn’t a good use of our engineering time. Cure the disease – including better UI hints in groups, last time I checked our groups admin UI is extremely poor.


I’ve made two changes that can hopefully make the flow a bit more intuitive. :muscle:

  1. If the user’s title is granted by their primary group, we will keep the title in sync when switching primary groups.

  2. When removing a title (due to leaving a group, etc), we will now automatically grant the user another of their available titles. This favors primary group title over the others.


Thank you @xrav3nz! This is great news.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

@xrav3nz there is a small edge case here which I don’t think is handled correctly

There are two groups, both have “automatically set as primary” = true

  • Add user to group1, their primary group changes, and their title is updated :white_check_mark:

  • Add user to group2, their primary group changes, but their title stays as grouptitle1 :x:

  • Remove user from group1, their primary group remains group2, and the title is corrected to grouptitle2 :white_check_mark:


Thanks, great catch! Fixed per

Technical details: primary group is updated with a direct SQL query, but the change title logic is in an ActiveRecord callback. This did not impact the “primary group” admin UI because that was updated with AR.


This topic was automatically closed after 3 days. New replies are no longer allowed.