Adicionar grupos ao componente de tema CSS ainda funciona?

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 curtidas

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 curtidas

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

1 curtida

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

1 curtida

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 curtida

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 curtidas

No worries, glad you got it sorted.

:+1:

2 curtidas

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