How to automatically set the user title for certain groups


#1

Hello,

I have created a special group at my site called “VIP”. So I want to set all the members who are in “VIP” Group a title called “VIP”.

How can I do this?


What exactly does "Automatically set as primary group" do?
Do not notify award of certain badges
(NomNuggetNom ) #2

As far as I know, groups can’t be used for titles. I suggested it yesterday:


(Jeff Atwood) #3

Did you try setting that as the primary group for the user?


#4

Yes, it shows groups: VIP on their profile page. But does not change the user titles.


(Sam Saffron) #5

This is now possible thanks to


(Michael Wransky) #6

@sam this feature recently stopped functioning as usual with no major changes done on our end. The people in the primary group now have no title showing for them. Any thoughts on a fix for this?


(Jeff Atwood) #7

If we can repro we should fix @sam.


(Tom Newsom) #8

How should we handle multiple primary groups?

For example, we have the group @members, which includes all the paying members of our organisation.

  • We also have @keyholders, which is a subset of @members who have physical access to our building.
  • We already have @members set as a Primary Group, so all members have “Member” as a user title.
  • We’d like to have @keyholders override @members so that their user title reads “Member (keyholder)” or similar.

Is this even possible? Setting @keyholders user title to a Primary Group does nothing.


(cpradio) #9

Maybe I’m simplifying this, but wouldn’t you just go to Admin > Groups > keyholders, set the User Title to “Member (keyholder)”, then for each individual in the @keyholders group, you would set their Primary Group to be @keyholders?


(Tom Newsom) #10

That doesn’t appear to work. I’m looking at a user with primary group set to @keyholders but their user title is still “Member”

Interestingly, Flair for @keyholders does work.

group membership is being driven by API, so people become members, then keyholders and obviously the latter overwrites the former. It’s just the user title that doesn’t carry over…


(cpradio) #11

Couple other questions that come to mind.

Does SSO pass in a User Title?
What happens if you remove the User Title (via Admin > User area) for one of the @keyholders members and have him login again?


(Tom Newsom) #12

We’re not using SSO (we want non@members to participate on our site)

Deleting the title and logging out+in results in the title staying blank.


(cpradio) #13

Sorry, not sure where I got the SSO from (probably lack of caffeine this morning).

Can I safely assume that Automatically set as primary group is properly set for @keyholders group in Admin > Group? Apart from that, I’m at a loss without digging into code.


(Tom Newsom) #14

You can.

I’ll try and repro this on a clean install if I ever have time.


(cpradio) #15

Okay, so here is what I’ve uncovered up to this point.

It seems to go based on the first group you auto-complete in the Group Box on Admin > Users page.

So I have 3 groups, Special, Special_Forces, and Special_Members. Special_Forces and Special_Members each have a custom default title defined. They also have ‘Automatically set as primary group’ checked.

When I clear out the title of a user and remove them from all groups (and save), nothing appears next to their posts (good so far).

Now I go to the Admin > Users page and type ‘Spec’, and then click on Special_Members, followed by typing ‘Spec’ again, and clicking on Special_Forces, skip setting the Primary Group (and click save).

Special_Members title is shown next to the user on their posts.

You can go and clear out the Title and set a Primary Group to your hearts content, but it doesn’t alter the Title at all, it will remain blank from you clearing it out.

The only way to get the Title set again, is to delete all of the groups out of the Groups box on the Admin > Users page, and to pick the group you want to set as the Title first, then followed by any other groups the member should be a part of.


So the above was using the Admin > Users page, what if you use the Groups pages?

In short, you have to do the same thing. You must ensure the existing Title is blank, then add the user to the group you want to be their Title first. Next add them to any subsequent groups you may want them on.


Hope that helps! I’m not sure it is 100% correct, or the title should be driven off of the Primary Group, but even if that were true, it still wouldn’t update the Title when changing the user’s Primary Group unless the Title is currently blank (that seems to be a consistent check that occurs with each process).


(Tom Newsom) #16

I think I get it. I also think that driving this groups dance for every user with the API is going to be more pain than it’s worth, so I’ll stick to using Flair for now :smiley:

This is probably worth tucking into a list of issues somewhere though - it’s rather inconsistent/unclear behaviour.


(cpradio) #17

Alternatively, there should be an API way of setting the Title, so maybe you could add that call? (though I do agree that the behavior is a bit weird around how the title gets set with Groups)


(Tom Newsom) #18

That’s probably more reliable. Good thinking :slight_smile:


(Kane York) #19

You can also add text with a CSS :after to the title. .group-prigroup.


(Tom Newsom) #20

Agh. Now I’m finding some users who are @members and @keyholders, but whose primary group is only @members.

Feels like a “degree of primacy” option is needed, so we can say for sure that group A overrides group C overrides group B in a consistent manner. (maybe repurpose the category sorting code?)

I think we’ll look into driving the Primary Group and Title via the API for now.