User profile page / CSS class for groups / how to add it to page?

I’m trying to hide the “summary section” of a user when that user is in a certain group, like “suspended” (and viewing that user profile page as a non-admin). I already have this theme component installed, CSS classes for current user's groups, and I’m using the recommended CSS that was provided:

body:not(.staff) .group-suspended .user-content-wrapper .user-content { display: none; }

The problem is, this CSS class, “group-suspended”, doesn’t appear on the page of a user profile that is suspended. I don’t see any “group-” CSS classes on the page.

What can I do to get this “group-” CSS class to appear on a user profile page?

Our website is: https://base.championteamtrading.com/

Thanks!

That component adds the CSS classes of the current logged in user to all pages the current user is viewing.

What you want is the opposite, to add group classes of the current viewed user profile page.

2 Likes

Thanks for the quick reply!

That is correct, that is what I’m trying to do, and is there an easy way to do this? I’ve looked for both:

  • an existing theme component to install to add the classes to the HTML, and
  • a pluginAPI function to get that user variable and write some code (but only found a function to get the current user)

but I’ve come us short so far.

Any help would be appreciated!

Thanks again.

1 Like

You will need to hook into the Ember code to obtain the profile user object groups attribute.

Changes like that are a bit more involved, but explained in detail at Developer’s guide to Discourse Themes

1 Like