Hi! I’m not really sure if this is the place to ask, but I need to hide a section from sidebar to anon users and the code in CSS is not working for that.
I put this in CSS in order to hide Community section for anonymous users
// * hide the Community section in side-bar from anon users*
.anon .sidebar-section-wrapper.sidebar-section[data-section-name="community"] {
display: none;
}
should be able to do the same for any other sections you want to hide from anon users.
edit: i fixed a space before “none”
btw, as an aside, if you want to hide all the lock badges on the secured category bullets in the side-bar, you can do this:
// * turn off the lock icon for all secure categories in the sidebar *
.sidebar-section-link-wrapper .sidebar-section-link-prefix.icon .prefix-badge, .sidebar-section-link-wrapper .sidebar-section-link-prefix.span .prefix-badge {
display: none;
}
i also tested it on a few other sections like categories and messages as well as one of my custom ones. just make sure you get the section name spelling right and all lowercase.
yea if the community has been changed with text replacement instead of translation, i think that may make a difference. i remember when i was playing around a while back with this, i noticed that i had to change my text replacement back to community to make it work, or use whatever text i had replaced it with. however i do not know if that is the case here or not.
getting the data section name correct is important. for example, if the replaced text has a space like on my forum, it needs to be a dash, and all lower case (eg: my site i have replaced “Community” with CFL Forums and the scss data section name is “cfl-forums” if i want to hide it). data section names are basically slugs.
// * hide any section in side-bar from anon users - "Section Name" = section-name * //
.anon .sidebar-section-wrapper.sidebar-section[data-section-name="section-name"] {
display: none;
}