# Hide Lock Badge Icon

**URL:** https://meta.discourse.org/t/hide-lock-badge-icon/276831
**Category:** Theme component
**Created:** [August 27, 2023, 4:15pm UTC](https://meta.discourse.org/t/hide-lock-badge-icon/276831 "2023-08-27T16:15:16Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [August 27, 2023, 4:15pm UTC](https://meta.discourse.org/t/hide-lock-badge-icon/276831/1 "2023-08-27T16:15:16Z")

</div>

| | | |
| --- | --- | --- |
| ℹ | **Summary** | Hides the lock badge icon for secure categories and chat channels |
| 🛠 | **Repository** | [https://github.com/Lillinator/hide-lock-badge-icon](https://github.com/Lillinator/hide-lock-badge-icon) |
| ❓ | **Install Guide** | [How to install a theme or theme component](https://meta.discourse.org/t/how-do-i-install-a-theme-or-theme-component/63682) |

Install this theme component

### Overview

This simple theme component allows for hiding lock badge icons for secure categories in the drop-down category selectors, header breadcrumbs, navigation sidebar menu, search results, and corresponding category chat channels.

Some people find the lock icon a bit misleading, thinking it means the category is locked and inaccessible. In Discourse, one can only see what they have access to, so the lock icon is simply an indicator that the category is restricted to others. Moreover, a lock icon is also used to signify a closed topic (this component does not hide those). Thus, some admins may simply wish to hide the category lock icon entirely, and that is what this component does.

### Settings

There is one setting - an option for toggling for Staff, since seeing the lock icon can be a useful indicator for Staff members.

### Screenshot

> **effect of component**
>
> Without component enabled:
> 
> ![image](https://global.discourse-cdn.com/meta/original/4X/d/6/1/d6162760f6179e9c87a4b8fb11512587384b8289.png)
> 
> With component enabled:
> 
> ![image](https://global.discourse-cdn.com/meta/original/4X/6/0/5/605be34a7007104f302bb28033c6f44d88734c99.png)

* * *
 **[Check out my other Discourse stuff](https://meta.discourse.org/filter?q=category%3Acustomization%20created-by%3ALilly%20order%3Acreated)**

---

<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: [August 27, 2023, 4:20pm UTC](https://meta.discourse.org/t/hide-lock-badge-icon/276831/2 "2023-08-27T16:20:31Z")

</div>

Nice! I’ve hacked a solution together for this a few times on various sites - brilliant to have it as a configurable theme component. You’ve got a knack for churning out some really useful customisations!!

Just checking - is it possible to use a Category selector instead of specifying each slug and ID? I would have thought that would be more durable for those like me who occasionally rename / move categories. Also, it might help with managing subcategories.

BTW at the mo, how should we input subcats?

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [August 27, 2023, 4:22pm UTC](https://meta.discourse.org/t/hide-lock-badge-icon/276831/3 "2023-08-27T16:22:58Z")

</div>

Thank you Nathan! I appreciate that 🙂

The lock icons are actually a bit tricky to hide in some places, that’s why the category ID is also required. I’m trying to figure out doing it also for search results but singling out select categories in the results seems near impossible. 🙃

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [August 27, 2023, 4:31pm UTC](https://meta.discourse.org/t/hide-lock-badge-icon/276831/4 "2023-08-27T16:31:05Z")

</div>

> [@nathank](#):
>
> BTW at the mo, how should we input subcats?

oh good point. Can separate the slugs with a forward slash like `category-slug/subcategory-slug` (ie: `boats/motorboats;8`) and just use the subcategory ID. But a subcategory will inherit the parent category if you are hiding the lock icon there.

I will add this to the OP.

> [@nathank](#):
>
> Just checking - is it possible to use a Category selector instead of specifying each slug and ID? I would have thought that would be more durable for those like me who occasionally rename / move categories. Also, it might help with managing subcategories.

Yea I actually started developing it this way but I was getting results that were not what I expected. I will continue to work this method out because it is preferred for the reasons you describe. Thanks for the great feedback Nathan, I appreciate it. 🙂

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [August 27, 2023, 6:17pm UTC](https://meta.discourse.org/t/hide-lock-badge-icon/276831/5 "2023-08-27T18:17:02Z")

</div>

I have updated the component for some of the field descriptions with corrections and more information about subcategories, and also edited the OP with the correct instructions for using subcategories.

---

<div class="post-metadata">

### Author: ![Nick-Permaculture](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nick-permaculture/32/317842_2.png) [@Nick-Permaculture](https://meta.discourse.org/u/Nick-Permaculture)
#### Post date: [August 29, 2023, 4:52pm UTC](https://meta.discourse.org/t/hide-lock-badge-icon/276831/6 "2023-08-29T16:52:48Z")

</div>

Excellent theme component that was created in response to a question I had on another topic here. Can’t thank you enough for putting in the time to help us non-CSS experts manage their forum more effectively.

---

<div class="post-metadata">

### Author: ![mattdm](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mattdm/32/216484_2.png) [@mattdm](https://meta.discourse.org/u/mattdm)
#### Post date: [August 30, 2023, 1:17pm UTC](https://meta.discourse.org/t/hide-lock-badge-icon/276831/7 "2023-08-30T13:17:05Z")

</div>

Ooh, thanks for this. I find all of those icons to be more distracting than informative — especially because they can mean so many different things in terms of actual access.

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [November 15, 2023, 6:01pm UTC](https://meta.discourse.org/t/hide-lock-badge-icon/276831/8 "2023-11-15T18:01:18Z")

</div>

I have updated this component with the following:

- setting for toggling display of lock icons for Staff
- leaving categories field blank default hides lock icon for all secured categories
- now hides lock in search results and search menu panel
- lock is hidden in the navigation sidebar menu category selector modal

 ![hide_lock_icon_settings](https://global.discourse-cdn.com/meta/original/4X/8/9/e/89e012d0f5231570b1d3278c5c4f29000286e090.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: [November 17, 2023, 8:03am UTC](https://meta.discourse.org/t/hide-lock-badge-icon/276831/9 "2023-11-17T08:03:38Z")

</div>

Nice!!! I love the extension to the navigation sidebar and search.

Have you had any further thoughts on having it as a category selector? To my ignorant mind, both the slug and the ID should be relatively straightforward to obtain from the category object.

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [November 17, 2023, 1:36pm UTC](https://meta.discourse.org/t/hide-lock-badge-icon/276831/10 "2023-11-17T13:36:25Z")

</div>

> [@nathank](#):
>
> Have you had any further thoughts on having it as a category selector? To my ignorant mind, both the slug and the ID should be relatively straightforward to obtain from the category object

heh, yea I worked on this a bit and got close but I was having trouble with the javascript to get the category slug from the ID. I know it’s possible and which methods in the existing library to use and the basic framework, I just need to spend some more time on it and debug. I have it so I can get most of it with the category selector, but in some places it requires the slug. I’m sure someone more proficient in javascript would be able to do it faster. LolaBot (GPT) was no help at all and kept creating nebulous arrays from thin air. lol

When I have some downtime, finishing it is on my Todo list. Also, now I have some more javascript gurus at my disposal. hehe

---

<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: [November 18, 2023, 11:48pm UTC](https://meta.discourse.org/t/hide-lock-badge-icon/276831/11 "2023-11-18T23:48:50Z")

</div>

> [@Lilly](#):
>
> Also, now I have some more javascript gurus at my disposal. hehe

🥂

### Another feature request

Would this TC be a good place for an alternative lock icon for categories?

I believe that 🔓 makes quite a bit more sense for categories and subcategories in Discourse. 🔒 seems a much better fit for closed topics.

BTW this has definitely hit the rule of threes (including yourself!). AND co-CEO love:

> [@Alternatives to lock icon for categories](https://meta.discourse.org/t/alternatives-to-lock-icon-for-categories/24815):
>
> Quite a bit later, but I still find the lock quite startling and confusing, it just feels like its a category that can not be posted into cause it was shut down. I really wish we could have a different icon there, even if its not the group icon.

> [@Alternatives to padlock icons on secured categories](https://meta.discourse.org/t/alternatives-to-padlock-icons-on-secured-categories/265530/23):
>
> the more i think about this, the more i believe the badge for a secure forum should be optional, and i think from a logical perspective, it should also be a key not a lock (as in, the user has the key to get in). yesterday i was doing some work on the component i use to control the sidebar and i enabled the lock badge on my lounge for about an hour and immediately users were confused thinking it was locked, and certainly the fact the lock badge just appeared was a big factor. but that badge is …

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [November 19, 2023, 12:45am UTC](https://meta.discourse.org/t/hide-lock-badge-icon/276831/12 "2023-11-19T00:45:24Z")

</div>

This is possible and I toyed with it when I was doing the component. When I replaced it with the unlocked padlock the difference in appearance wasn’t that noticeable because the icons are so small (the locked and unlocked ones don’t look much different at that size). I may revisit this. Even the key didn’t look great at that size. TBH.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [November 19, 2023, 1:57am UTC](https://meta.discourse.org/t/hide-lock-badge-icon/276831/13 "2023-11-19T01:57:41Z")

</div>

I think the [Category Icons](https://meta.discourse.org/t/category-icons/104683) theme component already has that feature if that’s any use?

---

<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: [November 19, 2023, 2:16am UTC](https://meta.discourse.org/t/hide-lock-badge-icon/276831/14 "2023-11-19T02:16:10Z")

</div>

It didn’t work on the sidebar last time I looked - that was probably fixed ages ago! But it works well now - thanks!

Perhaps the best path of all would be to combine the two TCs into one, as they both pertain to icons associated with categories, and this is an area of overlap.

---

<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: [April 20, 2024, 11:44am UTC](https://meta.discourse.org/t/hide-lock-badge-icon/276831/18 "2024-04-20T11:44:01Z")

</div>

Would you be open to adding compatibility with this excellent (but unofficial) Theme Component?

> [@Discourse Category Headers theme component](https://meta.discourse.org/t/discourse-category-headers-theme-component/148682):
>
> This theme component provides a number of enhancements for the Discourse category header. The ‘standard’ Discourse category header is displayed at the top of each category page, above the navigation links and list of topics. It is normally only visible if a category logo image has been uploaded in the category settings. The header displays the logo and a short description of the category, taken from the first paragraph of the ‘About the.. category’ topic. This theme component provides the foll…

Or maybe it should go the other way around and that should be made compatible with this one. What do you think?

---

<div class="post-metadata">

### Author: ![Rhidian](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rhidian/32/176630_2.png) [@Rhidian](https://meta.discourse.org/u/Rhidian)
#### Post date: [April 20, 2024, 12:42pm UTC](https://meta.discourse.org/t/hide-lock-badge-icon/276831/19 "2024-04-20T12:42:29Z")

</div>

Happy for anyone to put a pull request in including this? It looks like a useful addition.

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [April 20, 2024, 2:09pm UTC](https://meta.discourse.org/t/hide-lock-badge-icon/276831/20 "2024-04-20T14:09:47Z")

</div>

I’m open to whatever works. I don’t have time at the moment to work on this, but I know we have a general plan to make the hide lock badge component official, we just haven’t gotten to it just yet. I’m also wanting to improve it a bit - the category setting in particular isn’t intuitive enough; I really dislike those kind of delimited text input fields with separators. Probably could use a bit of a code refresh and update given some of our core changes. Feel free to fork and hack! PRs always welcome. I think this was one of the first theme components I built.

---

<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: [June 5, 2024, 5:53am UTC](https://meta.discourse.org/t/hide-lock-badge-icon/276831/21 "2024-06-05T05:53:50Z")

</div>

I’ve noticed a wee bug in this:

When I apply this to a Category, it also affects all subcategories of that Category (unhelpfully); this prevents it from being useful in my context of having restricted private subcategories.

---

<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: [June 5, 2024, 8:16am UTC](https://meta.discourse.org/t/hide-lock-badge-icon/276831/22 "2024-06-05T08:16:03Z")

</div>

And here is a PR to address it:

[https://github.com/Lillinator/hide-lock-badge-icon/pull/3](https://github.com/Lillinator/hide-lock-badge-icon/pull/3)

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [June 5, 2024, 2:25pm UTC](https://meta.discourse.org/t/hide-lock-badge-icon/276831/23 "2024-06-05T14:25:36Z")

</div>

Merged. thanks for doing that Nathan! 🤗

[Next page](https://meta.discourse.org/t/hide-lock-badge-icon/276831.md?page=2)
