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

**URL:** https://meta.discourse.org/t/user-in-multiple-groups-title-display-and-group-link-dont-match/96502
**Category:** Support
**Created:** [9월 6, 2018, 1:56오후 UTC](https://meta.discourse.org/t/user-in-multiple-groups-title-display-and-group-link-dont-match/96502 "2018-09-06T13:56:15Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![alxpck](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alxpck/32/243713_2.png) [@alxpck](https://meta.discourse.org/u/alxpck)
#### Post date: [9월 6, 2018, 1:56오후 UTC](https://meta.discourse.org/t/user-in-multiple-groups-title-display-and-group-link-dont-match/96502/1 "2018-09-06T13:56:15Z")

</div>

Hi,

We use groups in our Discourse to organize students into small study groups. The groups are open and students join or don’t join at their discretion. We tell them to only join one group, but we’ve got an edge case where a student joined 10.

 ![image](https://global.discourse-cdn.com/meta/original/3X/1/f/1f48bd8b56d35b46e9132dc0f1d9409ad7edd965.png)

We’re asking him to scale back to one group, which fixes the immediate problem, but we noticed some strange behavior:

1. His primary group is set to `baboon` (see above), but his title displays `whale` (see below)

 ![image](https://global.discourse-cdn.com/meta/original/3X/b/3/b3e4df58a5cb4dd600d90fc52c69f1dbd8342aee.png)

1. His title displays `whale` but it links to `baboon`

Is this a bug? Is it working the way it should?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [9월 6, 2018, 8:02오후 UTC](https://meta.discourse.org/t/user-in-multiple-groups-title-display-and-group-link-dont-match/96502/2 "2018-09-06T20:02:00Z")

</div>

You can only have one primary group, for sure, because otherwise how can the title be set based on membership in (x) different groups?

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [9월 6, 2018, 8:03오후 UTC](https://meta.discourse.org/t/user-in-multiple-groups-title-display-and-group-link-dont-match/96502/3 "2018-09-06T20:03:42Z")

</div>

Right, but once the user leaves the extra groups, he’s only in 1 group. Should Discourse update the title at that time to match the settings from the (only) group the user’s in?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [9월 6, 2018, 8:05오후 UTC](https://meta.discourse.org/t/user-in-multiple-groups-title-display-and-group-link-dont-match/96502/4 "2018-09-06T20:05:37Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![alxpck](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alxpck/32/243713_2.png) [@alxpck](https://meta.discourse.org/u/alxpck)
#### Post date: [9월 6, 2018, 8:23오후 UTC](https://meta.discourse.org/t/user-in-multiple-groups-title-display-and-group-link-dont-match/96502/5 "2018-09-06T20:23:31Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [9월 6, 2018, 8:26오후 UTC](https://meta.discourse.org/t/user-in-multiple-groups-title-display-and-group-link-dont-match/96502/6 "2018-09-06T20:26:45Z")

</div>

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

---

<div class="post-metadata">

### Author: ![alxpck](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alxpck/32/243713_2.png) [@alxpck](https://meta.discourse.org/u/alxpck)
#### Post date: [9월 6, 2018, 8:45오후 UTC](https://meta.discourse.org/t/user-in-multiple-groups-title-display-and-group-link-dont-match/96502/7 "2018-09-06T20:45:50Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [9월 6, 2018, 9:03오후 UTC](https://meta.discourse.org/t/user-in-multiple-groups-title-display-and-group-link-dont-match/96502/8 "2018-09-06T21:03:29Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [9월 6, 2018, 9:20오후 UTC](https://meta.discourse.org/t/user-in-multiple-groups-title-display-and-group-link-dont-match/96502/9 "2018-09-06T21:20:15Z")

</div>

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

---

<div class="post-metadata">

### Author: ![alxpck](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alxpck/32/243713_2.png) [@alxpck](https://meta.discourse.org/u/alxpck)
#### Post date: [9월 6, 2018, 10:33오후 UTC](https://meta.discourse.org/t/user-in-multiple-groups-title-display-and-group-link-dont-match/96502/12 "2018-09-06T22:33:19Z")

</div>

I support what @sam is proposing.

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

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [9월 6, 2018, 10:37오후 UTC](https://meta.discourse.org/t/user-in-multiple-groups-title-display-and-group-link-dont-match/96502/14 "2018-09-06T22:37:16Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![alxpck](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alxpck/32/243713_2.png) [@alxpck](https://meta.discourse.org/u/alxpck)
#### Post date: [9월 6, 2018, 10:38오후 UTC](https://meta.discourse.org/t/user-in-multiple-groups-title-display-and-group-link-dont-match/96502/15 "2018-09-06T22:38:29Z")

</div>

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

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [9월 6, 2018, 10:39오후 UTC](https://meta.discourse.org/t/user-in-multiple-groups-title-display-and-group-link-dont-match/96502/16 "2018-09-06T22:39:42Z")

</div>

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

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

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [9월 6, 2018, 11:17오후 UTC](https://meta.discourse.org/t/user-in-multiple-groups-title-display-and-group-link-dont-match/96502/17 "2018-09-06T23:17:24Z")

</div>

I just spent time reading through the code.

I can explain how it works now 😊

- 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)

---

<div class="post-metadata">

### Author: ![alxpck](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alxpck/32/243713_2.png) [@alxpck](https://meta.discourse.org/u/alxpck)
#### Post date: [9월 6, 2018, 11:29오후 UTC](https://meta.discourse.org/t/user-in-multiple-groups-title-display-and-group-link-dont-match/96502/19 "2018-09-06T23:29:19Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [9월 6, 2018, 11:45오후 UTC](https://meta.discourse.org/t/user-in-multiple-groups-title-display-and-group-link-dont-match/96502/20 "2018-09-06T23:45:14Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![xrav3nz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xrav3nz/32/76894_2.png) [@xrav3nz](https://meta.discourse.org/u/xrav3nz)
#### Post date: [9월 21, 2018, 2:40오전 UTC](https://meta.discourse.org/t/user-in-multiple-groups-title-display-and-group-link-dont-match/96502/22 "2018-09-21T02:40:25Z")

</div>

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

1. If the user’s title is granted by their primary group, we will keep the title in sync when switching primary groups.  
([FEATURE: match user title when primary group changes by xrav3nz · Pull Request #6404 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/6404))

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.  
([FEATURE: auto grant an available title when removing old title by xrav3nz · Pull Request #6416 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/6416))

---

<div class="post-metadata">

### Author: ![alxpck](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alxpck/32/243713_2.png) [@alxpck](https://meta.discourse.org/u/alxpck)
#### Post date: [9월 21, 2018, 5:48오후 UTC](https://meta.discourse.org/t/user-in-multiple-groups-title-display-and-group-link-dont-match/96502/23 "2018-09-21T17:48:35Z")

</div>

Thank you @xrav3nz! This is great news.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [10월 21, 2018, 5:54오후 UTC](https://meta.discourse.org/t/user-in-multiple-groups-title-display-and-group-link-dont-match/96502/24 "2018-10-21T17:54:35Z")

</div>

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

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [11월 13, 2018, 11:09오전 UTC](https://meta.discourse.org/t/user-in-multiple-groups-title-display-and-group-link-dont-match/96502/25 "2018-11-13T11:09:13Z")

</div>

@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 ✅

- Add user to group2, their primary group changes, but their title stays as grouptitle1 ❌

- Remove user from group1, their primary group remains group2, and the title is corrected to grouptitle2 ✅

[다음 페이지](https://meta.discourse.org/t/user-in-multiple-groups-title-display-and-group-link-dont-match/96502.md?page=2)
