# Categories: public vs. logged in only vs. restricted

**URL:** https://meta.discourse.org/t/categories-public-vs-logged-in-only-vs-restricted/156308
**Category:** UX
**Created:** [30 ביוני,‏ 2020,‏ 2:24am UTC](https://meta.discourse.org/t/categories-public-vs-logged-in-only-vs-restricted/156308 "2020-06-30T02:24:03Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![tomtjes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tomtjes/32/131271_2.png) [@tomtjes](https://meta.discourse.org/u/tomtjes)
#### Post date: [30 ביוני,‏ 2020,‏ 2:24am UTC](https://meta.discourse.org/t/categories-public-vs-logged-in-only-vs-restricted/156308/1 "2020-06-30T02:24:03Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![osioke](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/osioke/32/238946_2.png) [@osioke](https://meta.discourse.org/u/osioke)
#### Post date: [30 ביוני,‏ 2020,‏ 11:49am UTC](https://meta.discourse.org/t/categories-public-vs-logged-in-only-vs-restricted/156308/3 "2020-06-30T11:49:54Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![tomtjes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tomtjes/32/131271_2.png) [@tomtjes](https://meta.discourse.org/u/tomtjes)
#### Post date: [30 ביוני,‏ 2020,‏ 1:21pm UTC](https://meta.discourse.org/t/categories-public-vs-logged-in-only-vs-restricted/156308/4 "2020-06-30T13:21:05Z")

</div>

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 👁 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.

---

<div class="post-metadata">

### Author: ![torsi](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@torsi](https://meta.discourse.org/u/torsi)
#### Post date: [10 באוקטובר,‏ 2020,‏ 8:14pm UTC](https://meta.discourse.org/t/categories-public-vs-logged-in-only-vs-restricted/156308/5 "2020-10-10T20:14:15Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![tomtjes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tomtjes/32/131271_2.png) [@tomtjes](https://meta.discourse.org/u/tomtjes)
#### Post date: [13 באוקטובר,‏ 2020,‏ 2:01pm UTC](https://meta.discourse.org/t/categories-public-vs-logged-in-only-vs-restricted/156308/7 "2020-10-13T14:01:43Z")

</div>

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](https://global.discourse-cdn.com/meta/original/3X/c/e/ce825f97bbd932f469377cf5f5a7b74fc9141a10.png)

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [28 בדצמבר,‏ 2021,‏ 8:50pm UTC](https://meta.discourse.org/t/categories-public-vs-logged-in-only-vs-restricted/156308/8 "2021-12-28T20:50:35Z")

</div>

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. 🌐 on Categories set to `everyone`
2. No icon set on Categories allowing access to `trust_level_0`
3. 🔓 set on all other Categories

---

<div class="post-metadata">

### Author: ![ondrej](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ondrej/32/198804_2.png) [@ondrej](https://meta.discourse.org/u/ondrej)
#### Post date: [29 בדצמבר,‏ 2021,‏ 11:16am UTC](https://meta.discourse.org/t/categories-public-vs-logged-in-only-vs-restricted/156308/9 "2021-12-29T11:16:58Z")

</div>

> [@Category Icons](https://meta.discourse.org/t/category-icons-component/104683):
>
> warning This theme component is deprecated and should no longer be used. Its features are now in Discourse Core (see: [Bringing popular features to Discourse](https://meta.discourse.org/t/bringing-popular-features-to-discourse-header-search-welcome-banner-and-category-icons-emoji/359169)). For private category icon customization, refer to [this topic](https://meta.discourse.org/t/new-aliases-for-replacing-lock-icons-on-closed-topics-and-restricted-categories/373778). discourse2Summary Category Icons allows category badge links to have icons next to the category name.eyeglassesPreview [Preview on Discourse Theme Creator](https://discourse.theme-creator.io/theme/Discourse/category-icons)hammer_and_wrenchRepository Link [https://github.com/discourse/discourse-category-icons](https://github.com/discourse/discourse-category-icons) …

This TC should do it Nathan.

---

<div class="post-metadata">

### Author: ![tomtjes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tomtjes/32/131271_2.png) [@tomtjes](https://meta.discourse.org/u/tomtjes)
#### Post date: [29 בדצמבר,‏ 2021,‏ 4:02pm UTC](https://meta.discourse.org/t/categories-public-vs-logged-in-only-vs-restricted/156308/10 "2021-12-29T16:02:34Z")

</div>

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](https://www.flaticon.com/search?author_id=1&type=standard&word=globe), which I’ve added to my Discourse via [a sprite uploaded to a theme component](https://meta.discourse.org/t/replace-discourses-default-svg-icons-with-custom-icons-in-a-theme/115736))

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

```css
// 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;
}

```

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [30 בדצמבר,‏ 2021,‏ 2:58am UTC](https://meta.discourse.org/t/categories-public-vs-logged-in-only-vs-restricted/156308/11 "2021-12-30T02:58:34Z")

</div>

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:

```plaintext
// 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.

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [13 בדצמבר,‏ 2022,‏ 10:16am UTC](https://meta.discourse.org/t/categories-public-vs-logged-in-only-vs-restricted/156308/12 "2022-12-13T10:16:26Z")

</div>

A slight update to this so you can use it with the sidebar:

```css
// hides lock icons for ux category
.sidebar-section-link-ux .prefix-badge {
    display: none;
}
.category-ux .list-controls, [href = "/c/ux/9"] {
    .d-icon-lock, {
        display: none;
    }
}

```

---

<div class="post-metadata">

### Author: ![tomtjes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tomtjes/32/131271_2.png) [@tomtjes](https://meta.discourse.org/u/tomtjes)
#### Post date: [1 בינואר,‏ 2023,‏ 6:26pm UTC](https://meta.discourse.org/t/categories-public-vs-logged-in-only-vs-restricted/156308/13 "2023-01-01T18:26:43Z")

</div>

For category selection dropdown menus I added one more target:

```css
.category-ux .list-controls, [href = "/c/ux/9"], [data-value = "9"] {
    .d-icon-lock, {
        display: none;
    }
}

```

Also, for chat channels I suggest: `[href *= "chat/channel/9/"]`
