Display different content within a topic based on user's groups membership?

I don’t have too much time to dive into it right now but this theme component may help you because it’ll list all of the current user’s groups in, I think, the body tag. Then you could probably use CSS selectors to show/hide based on whether certain group class names exist in the body tag.

And combine that with some info from this post on how which HTML elements you can use in the composer and how to wrap composer text in classes, and it may work:

Yup, just tested it here and it should work if you use that component combined with something like:

<span data-group-a>Text only for group A</span>
<span data-group-b>Text only for group B</span>

And then have css selectors that do something like:

span[data-group-a] {display: none;}
body.group-a span[data-group-a] {display: block;}

Or something like that…

Sorry for all the edits. Just tested it on one of my instances and it works.

But as you mentioned, maybe that’s not what you wanted :slight_smile:

This might be possible with a theme javascript, adding something in the <head> section to select the elements and remove it. Still may require the span and wrapping as above, but remove it through that.

3 Likes