# Make a "locked" category visible (on the list of choices) to non-members?

**URL:** <https://meta.discourse.org/t/make-a-locked-category-visible-on-the-list-of-choices-to-non-members/54276>\
**Category:** Support\
**Created:** [2016年十二月15日 00:45 UTC](https://meta.discourse.org/t/make-a-locked-category-visible-on-the-list-of-choices-to-non-members/54276 "2016-12-15T00:45:41Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![bholst](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bholst/32/65051_2.png) [@bholst](https://meta.discourse.org/u/bholst)\
**Post date:** [2016年十二月15日 00:45 UTC](https://meta.discourse.org/t/make-a-locked-category-visible-on-the-list-of-choices-to-non-members/54276/1 "2016-12-15T00:45:41Z")

</div>

I hope that what I’m asking makes sense… Is it possible to lock a category from being able to see the threads, but yet still show that it (the category) exists?

Basically, we have a category that will be fairly popular, but I want new people to have incentive to actually sign-up or get to level 1, etc.

I want the category to show on the list, but I don’t want them to be able to view the contents. Is that even possible at this point?

---

<div class="post-metadata">

**Author:** ![bholst](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bholst/32/65051_2.png) [@bholst](https://meta.discourse.org/u/bholst)\
**Post date:** [2016年十二月15日 00:49 UTC](https://meta.discourse.org/t/make-a-locked-category-visible-on-the-list-of-choices-to-non-members/54276/2 "2016-12-15T00:49:48Z")

</div>

Perhaps this is the purpose of a group?

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [2016年十二月15日 05:32 UTC](https://meta.discourse.org/t/make-a-locked-category-visible-on-the-list-of-choices-to-non-members/54276/3 "2016-12-15T05:32:41Z")

</div>

> [@bholst](#):
>
> I want the category to show on the list, but I don’t want them to be able to view the contents. Is that even possible at this point?

Nope, I am afraid this is not possible, it would require a non-trivial custom plugin.

---

<div class="post-metadata">

**Author:** ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)\
**Post date:** [2016年十二月15日 05:50 UTC](https://meta.discourse.org/t/make-a-locked-category-visible-on-the-list-of-choices-to-non-members/54276/4 "2016-12-15T05:50:06Z")

</div>

There is a “require login” setting if you want to be strict about requiring members to register.  
But the only thing that will show is a “you need to login page” with no indication of what the forum is about.

The closest thing that I can think of to a “let them see but don’t let them see” tease is to create restricted categories and make a Banner post with links to them.  
Visitors will know the categories exist but will not be able to get to them until they login, which means they will need to be registered first.

---

<div class="post-metadata">

**Author:** ![JagWaugh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagwaugh/32/69335_2.png) [@JagWaugh](https://meta.discourse.org/u/JagWaugh)\
**Post date:** [2016年十二月15日 11:54 UTC](https://meta.discourse.org/t/make-a-locked-category-visible-on-the-list-of-choices-to-non-members/54276/5 "2016-12-15T11:54:56Z")

</div>

> [@Mittineague](#):
>
> The closest thing that I can think of to a “let them see but don’t let them see” tease is to create restricted categories and make a Banner post with links to them. Visitors will know the categories exist but will not be able to get to them until they login, which means they will need to be registered first.

I could imagine that some forums might want to be able to allow anon browsing, but only show the last N topics in each category. This would let an anonymous user see a bit of information about what the site is about, and how active it is so that they can make a considered decision about registering or not.

Probably a bother to make it core, but it would be a “nice to have” for some scenarios.

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2016年十二月15日 17:25 UTC](https://meta.discourse.org/t/make-a-locked-category-visible-on-the-list-of-choices-to-non-members/54276/6 "2016-12-15T17:25:28Z")

</div>

How about you pin a global topic that brags about your awesome hidden category? Or key them read but not respond?

---

<div class="post-metadata">

**Author:** ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)\
**Post date:** [2016年十二月16日 08:15 UTC](https://meta.discourse.org/t/make-a-locked-category-visible-on-the-list-of-choices-to-non-members/54276/7 "2016-12-16T08:15:04Z")

</div>

I admit I don’t understand why some would want to have teasers. Most want search engines to be able to find content. (Note - Google doesn’t log in)

Anyway, in terms of permissions there are these in Discourse:

Forum  
login required - if a visitor is not logged in (which requires being Registered), they can’t see anything

List pages display Category titles and Topic titles.  
Categories set permissions based on Group membership, where permissions can be set for

- Create-Reply-See
- Reply-See
- See

If a visitor is not in a Group that has at least “See” permission, they will not see the category title in any lists, nor will they see any topic titles for topics in the category or any posts made in topics in the category.

Topics  
Hidden - if a topic is hidden it can be accessed only by its URL. Its title will not display in any lists.

Posts  
Hidden - Posts can be hidden, but IMHO it’s more like “spoiler” than hidden.

There currently is no way to  
“Show Category title but not Topic titles”  
or  
“Show Topic titles but not posts”

_unless_ you post about them somewhere that can be seen.

---

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [2016年十二月16日 09:49 UTC](https://meta.discourse.org/t/make-a-locked-category-visible-on-the-list-of-choices-to-non-members/54276/8 "2016-12-16T09:49:35Z")

</div>

You could put the topics in a private sub-category that has a public parent category.

---

<div class="post-metadata">

**Author:** ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)\
**Post date:** [2016年十二月16日 10:28 UTC](https://meta.discourse.org/t/make-a-locked-category-visible-on-the-list-of-choices-to-non-members/54276/9 "2016-12-16T10:28:39Z")

</div>

> [@simon](#):
>
> You could put the topics in a private sub-category that has a public parent category.

Hmmm, I haven’t tried that (yet).

What shows where?

i.e. The restricted sub-category titles, topic titles for topics in that category.

---

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [2016年十二月16日 17:26 UTC](https://meta.discourse.org/t/make-a-locked-category-visible-on-the-list-of-choices-to-non-members/54276/10 "2016-12-16T17:26:04Z")

</div>

The parent category shows for all users, the restricted category and topics only show for members of the groups that have access to them. Everything seems to work exactly like you would expect it to, but I only tried this as far as creating a couple of restricted sub-categories and topics.

---

<div class="post-metadata">

**Author:** ![bholst](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bholst/32/65051_2.png) [@bholst](https://meta.discourse.org/u/bholst)\
**Post date:** [2016年十二月16日 18:17 UTC](https://meta.discourse.org/t/make-a-locked-category-visible-on-the-list-of-choices-to-non-members/54276/11 "2016-12-16T18:17:44Z")

</div>

Sub-categories… I didn’t think of that! I could create a parent category and pin a thread explaining that a ‘sub-category’ will show up when they become members or become trust level 1, etc. Good idea!! Thanks!!

---

<div class="post-metadata">

**Author:** ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)\
**Post date:** [2018年二月16日 22:28 UTC](https://meta.discourse.org/t/make-a-locked-category-visible-on-the-list-of-choices-to-non-members/54276/12 "2018-02-16T22:28:43Z")

</div>

I also think it would be really useful to let users see which categories exist, even if they can’t access them. For me it would not so much be a teaser but to provide orientation.

> [@sam](#):
>
> it would require a non-trivial custom plugin

Could you explain a bit more why this is “non-trivial”? Is it not possible to detach the visibility settings for the categories from the visibility settings for the category content?

If it is really impossible to add another category setting defining who can see the existence of the category but not the posts therein, one possibility could be to work with groups, i.e. the existence of a publicly visible group points to the existence of a hidden category. But the problem with this is that it forces you to make the group membership public. So, in a way, we have the same problem at the group level. This is particularly problematic in public forums where publicly visible groups are visible to the world. Perhaps it is easier to [add add more nuanced group visibility settings](https://meta.discourse.org/t/more-nuanced-group-visibility-based-on-group-membership/77129) on that) than to change the category visibility settings?

If so, I see two levels of possible improvement:

1. add a setting to limit group visibility to logged-in users
2. separate the group visibility from group-membership visibility

Oh, and what about the possibility of a creating a category page which simply lists all categories that are set to be listed? That could be another workaround for some scenarios…

* * *

BTW, this has come up before:

[https://meta.discourse.org/t/is-there-a-way-to-make-categories-visible-but-not-posts-in-the-categories/18141](https://meta.discourse.org/t/is-there-a-way-to-make-categories-visible-but-not-posts-in-the-categories/18141)

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2018年二月16日 22:58 UTC](https://meta.discourse.org/t/make-a-locked-category-visible-on-the-list-of-choices-to-non-members/54276/13 "2018-02-16T22:58:53Z")

</div>

> [@tophee](#):
>
> I also think it would be really useful to let users see which categories exist, even if they can’t access them.

One way that I’ve dealt with this was to create a topic that had all the categories. I thought I had some ruby code that would build the list, but sadly I don’t see it now.

---

<div class="post-metadata">

**Author:** ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)\
**Post date:** [2018年二月16日 23:03 UTC](https://meta.discourse.org/t/make-a-locked-category-visible-on-the-list-of-choices-to-non-members/54276/14 "2018-02-16T23:03:30Z")

</div>

> [@pfaffman](#):
>
> create a topic that had all the categories

Yes, I think this is probably where we’re heading, but I’d love to have this done automatically (so if you find the code, please do share), or, even better, to have a proper page for this, analogous to the group page.

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2018年二月16日 23:16 UTC](https://meta.discourse.org/t/make-a-locked-category-visible-on-the-list-of-choices-to-non-members/54276/15 "2018-02-16T23:16:25Z")

</div>

Found it! I don’t promise that it won’t hurt you.

```plaintext
def build_category_links
  # /scp:mr:/var/discourse/shared/standalone/backups/counties.html
  file = File.new('/var/www/discourse/public/backups/counties.html', 'w')
  categories = Category.where("name like '%SOMETING%'").sort_by &:name
  categories.each do |category|
    file.write "### [#{category.name}](/c/#{category.slug})\n"
    subcats = Category.where(parent_category_id: category.id).sort_by &:name
    category.name.gsub!(/, ,/,",")
    file.write "[details=\"click for #{category.name.gsub(/Some heading/,"")} \"]\n"
    subcats.each do |subcat|
      file.write "- [#{subcat.name.gsub(/, ,/, ",")}](/c/#{category.slug}/#{subcat.slug})\n"
    end
    file.write "[/details]\n"
    file.write "\n"
  end
  file.close
  nil
end

```

---

<div class="post-metadata">

**Author:** ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)\
**Post date:** [2018年二月16日 23:21 UTC](https://meta.discourse.org/t/make-a-locked-category-visible-on-the-list-of-choices-to-non-members/54276/16 "2018-02-16T23:21:49Z")

</div>

So I stick that into a plugin? Or how to use it?

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2018年二月16日 23:24 UTC](https://meta.discourse.org/t/make-a-locked-category-visible-on-the-list-of-choices-to-non-members/54276/17 "2018-02-16T23:24:48Z")

</div>

I used it at the rails console. It just writes out a file that I then pasted into a topic.

---

<div class="post-metadata">

**Author:** ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)\
**Post date:** [2018年二月16日 23:25 UTC](https://meta.discourse.org/t/make-a-locked-category-visible-on-the-list-of-choices-to-non-members/54276/18 "2018-02-16T23:25:36Z")

</div>

Might it be easier to hit site.json and get the values from that?  
`"categories":[{"id":10,"name":"howto",`

---

<div class="post-metadata">

**Author:** ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)\
**Post date:** [2018年二月16日 23:29 UTC](https://meta.discourse.org/t/make-a-locked-category-visible-on-the-list-of-choices-to-non-members/54276/19 "2018-02-16T23:29:16Z")

</div>

> [@pfaffman](#):
>
> then pasted into a topic

Oh, I see. So no automatic updating of the post.

Well, I still think this should eventually be solved in core.

---

<div class="post-metadata">

**Author:** ![fellowshipforums](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fellowshipforums/32/93448_2.png) [@fellowshipforums](https://meta.discourse.org/u/fellowshipforums)\
**Post date:** [2018年四月11日 03:33 UTC](https://meta.discourse.org/t/make-a-locked-category-visible-on-the-list-of-choices-to-non-members/54276/20 "2018-04-11T03:33:35Z")

</div>

I also have a use case to be able to make a locked category visible as an incentive to non members, or members with a lower trust level to participate more. I have built an exam testing tool for students to use to test their knowledge (see “Past Exams” category). I would like non-members and users with a lower trust level to be able to see the 2 most recent practice exams, and then see all remaining exams (another 6-8 of them) locked and “greyed out.” This will incentive users that if they want to have access to more practice exams, they need to participate in the forum.

Current View to Non Members:

 ![image](https://global.discourse-cdn.com/meta/original/3X/b/0/b06e1ea3e594e31d5f6c1f72f27307dbd32d4c3f.jpg)

Admin View (I want Non Members to be able to see the locked categories below, ideally in a “greyed out” style.)

 ![image](https://global.discourse-cdn.com/meta/original/3X/f/b/fb88d6e5e4c3a20e1976cb9c5b90b8eaa6375a4b.png)

Is this possible today? Anyone have any ideas on how I could achieve something like this?

[下一頁](https://meta.discourse.org/t/make-a-locked-category-visible-on-the-list-of-choices-to-non-members/54276.md?page=2)
