Enabling category previews for restricted paid access categories

I believe I found a workaround that lets me realize the desired user experience without messing with Discourse’s security architecture.

This example is not about paid-restrictions but with a similar goal. We have restricted categories for working groups on this forum. We’d still want to promote their existence and attract interest in joining them. So I’d like these categories be visible for every forum user as on this mockup:

Now to show the categories, no matter if a user actually has access or not, I added the restricted ones plus I added public “shadow” categories to each of them. Here’s my admin view of all categories for Community Builders and Translators:

Now a user without special access just sees the public boxes and can visit the categories and find respective information about the groups:

Once a user has actual access to a restricted category, I hide the public one with CSS. Let’s say a user joined Translators. They will have this view:

I use a component to address user groups with CSS: GitHub - discourse/discourse-groups-css-classes-in-body · GitHub

Then the declaration is rather straightforward:

body.group-translators {
    .category-box-translators-join,
    .select-kit-row[data-name="Join Translators"] {
        display: none !important;
    }
}

Well, it’s still some effort.. but I like the user experience. And it adds the advantage that users that don’t have access to the group as such can still engage with group leads on the public categories – without adding noise to the actual group discussions.

4 Likes