View only category

Would it be possible to set category permission so everyone can see the category and introduction post but not the other posts. After reading the intro they can for example subscribe and see the other posts.

https://meta.discourse.org/t/regarding-category-permission-setup/16945

Sometimes information is confusing. I find old posts as this one where it say it can’t be done, but then I find new ones where it is added.

1 Like

This request makes no sense. Describe why anyone would want this behavior please, with examples.

Probably not the reason @Miro wants it, but I could see that being very useful for the discussion of anything that makes people feel squeamish. The introductory post about the category can warn you away from the content inside, if it is something that will not sit well with you.

1 Like

There is a great need for that.

If want someone to subscribe to the forums category, how he will know what is inside if he can’t even see the category or titles of the posts.

For example I have instructions how to do something , they are free. 20% people can use it but remaining 80% because of complexity can not. I do not want to waste time with detailed explanation and specific questions. Who needs such level can subscribe and get it.

SMF forum has “view only boards mod” where everybody can see category and post titles then they decide if they want to subscribe. Only in that section support for particular product is provided.

This has come up before here and here. Other platforms address it with category visibilty settings for

  • Public - can see category and topics
  • Private - can see category only (including description but not topics)
  • Hidden - only group members see category and topics

Adding a Private visibilty setting would help people know a category exists, how to join via category description, etc. Would be nice not to have to use group membership to make categories suddenly appear after joining.

Showing titles of posts but not content would be trickier.

I still do not get this use case at all, and almost nobody (that can present a rational, coherent story about it to me) is asking for it.

So like… a porn category, or something? I really do not get this at all and never have.

The cited topics are incredibly weak, @scombs. Not a reflection on you, just that I honestly find the arguments for this “need” to be extraordinarily thin. Color me utterly unconvinced. Where is the killer app here? Heck where is the modestly convincing app?

Ecamples:

  • Public category for an organization that have private subcategories for committees.

  • Private category like for discussion group/email list.

General public users wont see these categories at at all so site admins have to use things like pinned topics, group page, etc.

Even users who are members of a private category but are not logged in won’t see that category. So users get lost when they come back to the site and can’t find their private category.

It would be nice to have category view and menu options to surface the categories to users with a reminder to login or instructions to join.

I am taking #lounge category as example.

So you like everyone (even guests) to aware of the existence of #lounge category and procedures to join and participate in it by displaying the category name (and pinned topic) in categories list. I am right?

1 Like

Adfitional live examples

My site has all private categories because the subject matter varies widely. I uses one public category with topics to direct users to the group page for sign up.

Using groups for topics like Politics that are optin. Users have to find the group page instead of seeing it in a category view or menu.

It’s more of a UX issue. The current options are good. Just trying to solve for new and not logged in users.

Edit: BuddyPress documenation on same features.

I don’t have exact solution for you. But I have good work around. Put the below code in admin/customize/body page.

<script>
var TopicTrackingState = require('discourse/models/topic-tracking-state').default;
function addCategories(model) {
    
    var categories = [
            { id: 200, name: "First Private Category", url: "/groups/my-group-page", color: "79a", description_excerpt: "hi, this is description"  },
            { id: 201, name: "Second Private Category", url: "/groups/my-group-2", color: "f9a", description_excerpt: "hi, this is description" }
        ];
        
    categories.forEach( function(item, index) {
        item.read_restricted = true;
        item.topicTrackingState = TopicTrackingState.create({});
        
       var category = Discourse.Category.create(item); 
       
        if (!Discourse.Site.currentProp('categoriesById')[category.id]) {
            if (model) {
                model.categories.addObject(category);   
            } else {
                Discourse.Site.currentProp('categories').addObject(category);
            }
        }
    });
    
}
Ember.run.later( function () {
    addCategories(); 
}, 1000);

var DiscoveryCategoriesRoute = require('discourse/routes/discovery-categories').default;
DiscoveryCategoriesRoute.reopen({
    afterModel(model) {
        addCategories(model);
    }
});
</script>

In above code you can add all private categories which you want to showcase by putting it in each lines like below

{ id: 200, name: "First Private Category", url: "/groups/my-group-page", color: "79a", description_excerpt: "hi, this is description"  },
{ id: 201, name: "Second Private Category", url: "/groups/my-group-2", color: "f9a", description_excerpt: "hi, this is description" }

Here id must match to the original category id and you should put relevant group’s url in the url field.

4 Likes

@Vinoth Kannan

How can I find the category ID?

Add at the end of your URL /site.json (e.g. https://my.domain/site.json).

Then you need an online tool (try https://jsonformatter.curiousconcept.com/) to read it without going crazy.

4 Likes

I did read it without getting crazy :-). It lists category but when i click on it get an error.

Oops! That page doesn’t exist or is private.

Maybe make blocks with information and links as dicourse have here:

https://meta.discourse.org/c/howto

You should give existing url (in your case group link is better) in url field.

As I told it may not be the exact solution for you.

Edit: Else you can make a custom plugin.

1 Like

i did add category link, that’s why it says

Oops! That page doesn’t exist or is private.

I know only how to install plugins nothing more.

Above script is working on your Discourse and displaying the link properly. The problem is when you click the link it gives page doesn’t exist error. Right?

In this script user can’t view the category actually. That’s why it return the error. So in the url field you must give any existing public topic url (or any public url) which is describing about that category.

Ah, Ok.
That makes it more logical.
It can go to post where would be description.

Still I will miss the SMF way.

Thanks

1 Like

Almost. You can create a group that allows people to join of their own accord and set the category so that only group members can join. The won’t be able to read the category introduction, though, so you’d need to create a topic for that somewhere else that describes the category and how to join the group.

2 Likes