Categories: public vs. logged in only vs. restricted

Is there a way to distinguish between categories visible to logged in users only and categories visible to certain groups?

At the moment, I use CSS to hide the lock icon in front of all categories that are visible to logged-in users only. Now I would like to put a group icon in front of categories that are restricted to groups.

3 Likes

While I understand your question, I am thinking about the use case. Especially because only users who can see the categories, see the categories regardless of groups or logged-in state. So how would the differentiation help? I do not think there is way though, but I might be wrong.

The use case is the same as for the lock icons, which, I think, is to remind users: if you post here or share a link from here it won’t be accessible by everyone.

I feel like I don’t need that reminder for login-only categories, because very few categories on my site are visible to anonymous users. (Instead, I mark the publicly visible category’s with an :eye: icon to remind users that these are out in the open internet.)

For categories that have more restrictions than “must be logged in”, it can be less obvious that they’re for a more or less exclusive group only. New users might have been granted access to a group when they first created their account. So from day one they’re seeing a different set of categories than some other users, but unless the category name or description (if they read it) includes a hint, they couldn’t tell that a category is visible only to some. Older users might forget that this one category they once were granted access to is not in fact accessible by all.

So, in short, a quick visual reminder like the lock icon makes more sense to me for restricted categories than applying it to almost all categories on a mostly logged-in only site.

2 Likes

We’ve recently made a category restricted to a higher trust level and now people keep thinking those topics have been closed. Closed and restricted are different things and it is confusing for them to have the same icon. A lock is generally understood to indicate that the person seeing it doesn’t have full access, not that it is hidden from other people.

1 Like

In the meantime, I decided to indicate in front of each category, what the level of access is. I’m using a globe for categories that are public (anonymous access), a “group” icon for categories accessible by logged-in users and a “friends” icon for other restricted categories.
Screen Shot 2020-10-13 at 09.55.39

2 Likes

How are you achieving this? I think that it is a great idea and as we inch our site towards having a couple of public categories I’d love to do something similar for them. Love the globe!

I’d love to achieve:

  1. :globe_with_meridians: on Categories set to everyone
  2. No icon set on Categories allowing access to trust_level_0
  3. :unlock: set on all other Categories

This TC should do it Nathan.

Yup, that’s what I use. In the svg-icons field, enter users, user-friends and whatever symbol you want to use for public access (for the globe, I’m using an icon by Freepik, which I’ve added to my Discourse via a sprite uploaded to a theme component)

I hide the lock icon with this CSS added to a theme component:

// no lock icon for private categories
.category .badge-category.clear-badge.restricted .d-icon-lock, 
.badge-category.clear-badge.restricted .d-icon-lock,
.category-list .category-text-title .d-icon-lock,
.category-box-heading .d-icon-lock {
    display:none;
}
1 Like

I’ve come up with a variation of your idea, where I can hide the lock icon selectively on just the categories which are accessible to TL_0 (manually).

As there isn’t a nice convenient CSS class for this, you must target the hover (title) and link (href) properties instead, and must also do this for each of the categories that you want to hide the lock icon for:

// hides lock icons for ux category
[title = "ux"], [href = "/c/ux/9"] {
     .d-icon {
         display: none;
     }
}

It would of course clash with any icons from the Category Icons Component, but this can be mitigated by targeting .d-icon-lock (or whatever icon you are using) instead of .d-icon for that category.


I’ve just edited that CSS after discovering I was missing some of the icons. It works much better now, but will easily break if you change your category structure.

2 Likes