User Group class not always being applied to post content's wrapper div

I’ve got User Groups for e.g. Volunteers & Donors & etc who have contributed to keeping the site running. I’d like to visually distinguish the posts by these users, for example by adding a border around the entire post:

.group-Volunteers > article {
    margin-top: 0.2em;
    margin-bottom: 0.2em;
    border: 0.2em dashed var(--tertiary);
    border-radius: 1em;
    padding-left: 0.5em;
}

This is working as expected for one of the groups, but not another. Are there rules for when the group-* class will be applied to the wrapper container?

Example: Introducing Gizz Tapes! - #13 by jamie - Some Context - KGLW.net Forum
The user who posted this is a member of the Volunteers group, however the post’s wrapper div does not have group-Volunteers class like I’d expect. (Note that in this topic are several posts from users in the Core group, and their posts do have a group-Core wrapper.)

I believe it must be their primary group, is the Volunteer group the user’s primary one, and does changing it fix the issue?

2 Likes

You can also use CSS Classes for Current User's Groups. Then it works for all groups instead of just primary ones

2 Likes

Hm, I’ve added this component to our theme but it doesn’t seem to have changed the CSS classes on the post in my example above.

I think I’d prefer to use this component, although I don’t know what the “primary group” setting entails. What happens if a user is a member of multiple groups which have the “automatically set as primary group” option turned on?

1 Like