Does adding groups to CSS theme component still work?

Does this Theme Component still work?

It didn’t seem to do anything for me despite lots of groups being set to be visible to ‘logged in users’. It could be very handy for several things!

As far as I know, Discourse adds the user groups to the body tag without any theme component :thinking:

Captura

2 Likes

I just tried it, and it seems to work fine. Do you see any errors in the console?

To be clear, that component only adds the current user’s groups as CSS classes on the <body> tag.

We use that component here on Meta. Discourse only adds a single class for the current user’s primary group by default.

3 Likes

Interesting fact, I had seen it in other communities and assumed it was something by default :sweat_smile:

1 Like

Hmmm - maybe it doesn’t work in login-only sites. Or if group visibility is set below everyone.

1 Like

Just tested that, and it worked OK for me. As soon as the user is logged-in, the group classes get added to the <body> tag.

I also tested that, and it seems to work without issue. I tried all five visibility options.

Can you share a link to the site you’re seeing this issue on?

1 Like

Actually, the problem was user stupidity!

I was adding it to the default Theme. Unfortunately I forgot that I was using a dev Theme for my own account. Doh!

Thanks for looking into it, and sorry to waste your time! It is a good TC - could do with some documentation, eh?

2 Likes

No worries, glad you got it sorted.

:+1:

2 Likes

This topic was automatically closed after 4 hours. New replies are no longer allowed.