# Discourse groups css classes in body

**URL:** https://meta.discourse.org/t/discourse-groups-css-classes-in-body/180194
**Category:** Support
**Created:** [February 18, 2021, 1:39pm UTC](https://meta.discourse.org/t/discourse-groups-css-classes-in-body/180194 "2021-02-18T13:39:33Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Ed\_Bobkov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ed_bobkov/32/200014_2.png) [@Ed\_Bobkov](https://meta.discourse.org/u/Ed_Bobkov)
#### Post date: [February 18, 2021, 1:39pm UTC](https://meta.discourse.org/t/discourse-groups-css-classes-in-body/180194/1 "2021-02-18T13:39:33Z")

</div>

Thanks to @Johani I found this great theme component made by @Falco 🙏 Now all groups of a user are set in the body tag. I was searching for a solution but didn’t find any mention of this component.

[https://github.com/discourse/discourse-groups-css-classes-in-body](https://github.com/discourse/discourse-groups-css-classes-in-body)

I found a strange thing about the component (except admin user). When I add a user to a group, the body tag is not changing - a newly added group is not showed in the body tag.

I refreshed the page, logout, checked in incognito, switched between browsers, checked on different servers… nothing helps.

@Falco, can you please check the problem?

Update: the problem is caused because of the Visibility status of the chosen groups. I had set: Visible to group owners and Admin. That’s why the component couldn’t show the group name in the body tag. If I set to Visibility: Everyone - it started working correctly.

I think this is not a correct work of the component. Am I right?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [February 18, 2021, 2:16pm UTC](https://meta.discourse.org/t/discourse-groups-css-classes-in-body/180194/2 "2021-02-18T14:16:05Z")

</div>

> [@Ed\_Bobkov](#):
>
> I think this is not a correct work of the component. Am I right?

That is the expected behavior of the component. If a group is not visible to the current user it won’t be added to the body class list, as that would be an information leak.

---

<div class="post-metadata">

### Author: ![Ed\_Bobkov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ed_bobkov/32/200014_2.png) [@Ed\_Bobkov](https://meta.discourse.org/u/Ed_Bobkov)
#### Post date: [February 18, 2021, 2:19pm UTC](https://meta.discourse.org/t/discourse-groups-css-classes-in-body/180194/3 "2021-02-18T14:19:54Z")

</div>

Thank you! I understood. By the way, you component solve a very important task. It should be at least in the components list.

---

<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: [March 20, 2021, 2:20pm UTC](https://meta.discourse.org/t/discourse-groups-css-classes-in-body/180194/4 "2021-03-20T14:20:03Z")

</div>

The Theme Component mentioned above has now been published:

> [@CSS Classes for Current User's Groups](https://meta.discourse.org/t/css-classes-for-current-users-groups/226068):
>
> discourse2Summary CSS Classes for Current User’s Groups adds the groups that a member is a part of as CSS classes on the \<body\> tag.eyeglassesPreview [Preview on theme-creator.discourse.org](https://discourse.theme-creator.io/theme/Johani/user-groups-css-classes)hammer_and_wrenchRepository Link [https://github.com/discourse/discourse-groups-css-classes-in-body](https://github.com/discourse/discourse-groups-css-classes-in-body)open_bookNew to Discourse Themes? [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) Install this theme component Before: [image] After: [image] Discourse only adds the current us…

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