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


(Bryan Holst) #1

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?


(Bryan Holst) #2

Perhaps this is the purpose of a group?


(Sam Saffron) #3

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


(Mittineague) #4

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.


(Andrew Waugh) #5

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.


(Jay Pfaffman) #6

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


(Mittineague) #7

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.


(Simon Cossar) #8

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


(Mittineague) #9

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

What shows where?

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


(Simon Cossar) #10

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.


(Bryan Holst) #11

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!!


(Christoph) #12

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.

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 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:


(Jay Pfaffman) #13

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.


(Christoph) #14

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.


(Jay Pfaffman) #15

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

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

(Christoph) #16

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


(Jay Pfaffman) #17

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


(Mittineague) #18

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


(Christoph) #19

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

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


(Fellowship Forums) #20

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

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

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