Category Previews

You are doing a good job with your English :slight_smile: The set-up for this is tricky even when English is your native language.

Yes, you will want to follow this guide: How to use category security settings to create private categories

Close!

If it helps, here is what I have in my theme setting for the demo:

junk~restricted category preview~This category is only available to members of the "joinable-group" user group. Select for more information.~https://theme-creator.discourse.org/pub/logged-in-user-access~joinable_group

And how it relates to the description of the theme setting:

Theme Setting Part Value
category-slug junk
Preview Name restricted category preview
Preview Description This category is only available to members of the "joinable-group" user group. Select for more information.
https://example.com https://theme-creator.discourse.org/pub/logged-in-user-access
group joinable_group

And here is a diagram to show how the different parts relate:

In the image, " :lock: restricted" is the real category that can only be accessed by the joinable_group user group (and staff by default).

7 Likes

Thank you for your time dude. Ok ok it’s much clearer that way. And actually it was not obvious ^^

So lets do that ! and thanks again :slight_smile:

1 Like

Hi, its me again ^^

So, i put the settings here :

I have some questions :

1 : How build URL ?
2 : When we write the settings close to “category previews” after i confirm that. Its finish ?
3 : I did that but impossible to see the private category. I need to create that manually or not ?

Thansk and again sorry, its too hard for me.

1 Like

Hi :slight_smile:

  1. Which URL? Can you share the full value of the category previews theme setting in your screenshot? I should be able to give you suggestions based what you have entered into that setting.

  2. When you make a change to the category previews setting, click outside of the text field and you should see two buttons appear. Use the green one to save changes. After you save the changes, you will need to refresh any open browser tabs/windows to see the effect.

  3. Assuming Groupe privee is a category you have already created, you need to find and use the slug for it. It will most likely be something like group-privee. You can confirm this by navigating to the Groupe privee category and looking at your browser’s address bar. For example, the #theme category here on Mete uses theme as the slug:

1 Like

Thanks for your reply.

So here is the category preview : Groupe privee~Parlons societe offshore~Cette catégorie est seulement disponible aux utilisateurs ayant rejoint le groupe.~https://forum.objectifhijra.com/pub/logged-in-user-access~groupe_joignable

If i understand correctly, the category must be created earlier ? I tried with existing category and same thing, nothing happen.

Yeah, i spoke about of URL in the categroey preview. How we build this URL ? Or if we need to create the category before, so i take the URL which is created by discourse.

1 Like

There are a few things to address:

  1. Your forum is using boxed categories, so it will not work. From the original post:

  2. The first part of your setting (Group privee) needs to be the slug of an existing, public category. The preview will display above this category. It should not be the name of the category you are trying to preview.

  3. It doesn’t look like URL you are using (https://forum.objectifhijra.com/pub/logged-in-user-access) is a real published page. You would need to create a published page using the instructions at Page Publishing and use the generated link to that page.

  4. Make sure you actually have a group with the name groupe_joignable

Unfortunately, I’m not sure how much more I will be able to help you. It’s fairly difficult to explain on its own and I think our language barrier isn’t helping. What I might recommend is posting in our #marketplace category to see if you can hire someone to log into your site and help you directly.

3 Likes

Its ok dude. I understood everything ! Thanks.

Im so sad it doesnt work with boxed categories style :frowning:

How can i do…

Anyway, thanks for everything. Im sure that will help other people.

2 Likes

I just learned about this theme component and am excited that it may streamline some workaround hacks I’d been using. A couple questions that I couldn’t tell if were just beyond my understanding of how things work, or haven’t been created yet:

  1. Should anonymous (not logged-in) users be able to see the category preview item in the /categories listing? I was hoping that they might see what’s available to encourage them to create an account, but in my tests so far I haven’t been able to make that happen.

  2. Are admins able to see the category preview even if they’re in the specified group that shouldn’t see it? I am in group-x as specified in the string, but am still seeing it above the actual restricted category.

4 Likes

Absolutely, that’s one of the most important scenarios this component should be covering! Can you make sure you are using the slug of the category the preview should appear above? In case it’s helpful, this post breaks down the settings a bit more than the OP.

Yes, I wanted to make sure staff (mods/admins) always see the preview so they are always aware of it’s existence and placement. It’s best to use a test user account when testing out component.

4 Likes

Thanks for those tips.

I tried a second example:

internal~Join Group X!~Come join our formerly top secret group.~https://example.com/~group-x

… then checked with both an anonymous session, and also by impersonating a non-admin and non group-x member user account. Unfortunately neither preview showed up including this second confirmation one. For my admin account, it looked OK, appearing directly above the “internal” slug category, as expected, with the correct link destination, etc.

We do have some things that aren’t quite normal seeming with respect to category displays, so it’s possible this is related to that, unless other folks end up finding a similar type of non-expected behavior. :slight_smile:

2 Likes

It is odd that it would display for the admin, but not for the other users that should also see it. Just to be sure, your internal category is visible to anons and non group-x users?

3 Likes

Thanks for that clue! I had misunderstood the purpose of the first field in the string. I had been using the “members only category” associated with group membership.

Once I changed the first field to an existing, public, open-to-everyone category, everything worked as expected. :tada:

news~Join Group X!~Come join our formerly top secret group.~/pub/membershipinfo~group-x

TLDR (for how my brain interpreted it) - I needed to understand that the first field is where you want the “preview” advertisement to appear in the category list. (In this case, just above the public “news” category.)

3 Likes

I really appreciate you saying this. I had thought that the category slug in the settings was for an existing private category that I wanted to pull into the category menu. Instead, I’ve realized that this theme component is basically just allowing us to put in a custom link above a specific category in the category list and that the link really doesn’t have to be related to an existing category. For example, I just put welcome~Visit Google!~This is just a custom link in the category list~https://www.google.com and it worked.

I think I was getting confused by the name Category Previews and not seeing how it functioned, so thank you for pointing that out.

Also, I note that this seems to only appear in the category list view, not on the category dropdown menu or in search.

2 Likes

@tshenry is it possible to findout how we can make this category private with boxed style ?

2 Likes

As luck would have it, I just added support for the “Boxes with Subcategories” desktop category page style :slight_smile:

Note that “Boxed with Featured Topics” is still not supported yet.

7 Likes

A post was split to a new topic: Adding a section above the boxed categories list

@tshenry is there a way to hide these from staff?

It’s very confusing seeing the real category and the fake category together, we keep clicking on the wrong one :man_facepalming:

Even a CSS hiding trick would do :blush:

1 Like

I understand that the slug is the one for the category just below this fake category label. Then there needs to have a reachable category below.
Is there a way to put the fake label at the bottom of the list? Is there a special slug like at-last or something that would allow to put it completely below everything?

Edit : I’ve found a hack.
I have added a dummy category where no one has any writing right but everyone has reading right. I hide this category with CSS display="none", and I made it appear last. It’s totally not satisfying but… it works great.

This is a great component, but I’m having some issues with it not hiding the actual category. I have tried this with a non-admin account and as anon. Below is what I see along with my settings. Am I doing something wrong or is there a bug?

URL of category: https://community.naturephotographers.network/c/beginners/147

Category previews entry:

beginners~Beginners Feedback~A place for beginner photographers to share their images and get feedback in a comfortable atmosphere with other beginners. Experienced members of NPN will give feedback to help guide beginners in their photographic journey.~/g/Beginners~Beginners,Beginner_Support
1 Like

Where are you adding this CSS please @oca ?

EDIT: Found it here and changed the ID to suit: How to Hide the Staff Category with css? - #3 by Tim_Jefferies

2 Likes