네비게이션(사이드바) 메뉴 표시 제어

:information_source: 요약 직원, 로그인 사용자 및 익명 사용자에게 섹션과 링크를 표시할 수 있도록 허용합니다
:hammer_and_wrench: 저장소 https://github.com/Lillinator/navigation-menu-display-control
:question: 설치 가이드 테마 또는 테마 컴포넌트 설치 방법
:open_book: 디스코urse 테마를 처음 사용하시나요? 디스코urse 테마 사용 입문 가이드

이 테마 컴포넌트 설치

설명

네비게이션 메뉴 표시 제어(Navigation Menu Display Control) 테마 컴포넌트는 직원 전용 및/또는 로그인 사용자 전용으로 다양한 기본 섹션과 링크를 표시할 수 있게 해줍니다. 또한 사용자 지정 섹션이나 사용자 지정 링크(플레이스홀더 이름 포함)를 지정할 수도 있습니다. 익명 사용자 전용으로 사용자 지정 메뉴 섹션을 표시하는 설정과 기본 섹션(카테고리, 태그, 채팅, 채널, 메시지)의 순서를 설정하는 옵션도 있습니다. 설정 내의 섹션과 링크는 기존 섹션으로 편집할 수 있는 목록이며(아래 스크린샷 참조), 원하는 만큼의 사용자 지정 섹션이나 링크를 추가할 수 있습니다.

설정

:point_right:t2: 사용자 지정 메뉴 섹션의 경우, 설정 시 전역적으로 표시 가능해야 합니다(이 섹션을 공개하여 모든 사람이 볼 수 있게 만들기 체크박스가 활성화되어 있어야 함).

상단 섹션은 코드에서 "community"라고 불리므로, 이 섹션을 숨기려면 “community” 섹션 이름을 사용하세요. 플러그인으로 설치된 링크(예: 문서, 기념일, 생일 링크)를 사용할 수 있습니다.

서로 오버라이드되는 설정도 있습니다 - 로그인 사용자에게 '더 보기(More)'에 특정 링크가 표시되도록 설정하더라도, ‘더 보기’ 드롭다운 설정이 직원 전용으로 표시되도록 설정되어 있으면 해당 설정이 우선 적용됩니다.

설정 이름 설명
show these sections for staff only 직원만 표시할 섹션 목록. “Staff Menu = staff-menu” 슬러그 스타일 명명 형식으로 사용자 지정 섹션을 포함할 수 있습니다.
show these sections for logged-in only 로그인 사용자만 표시할 섹션 목록. “User Menu = user-menu” 슬러그 스타일 명명 형식으로 사용자 지정 섹션을 포함할 수 있습니다.
show these links for staff only 직원만 표시할 링크 목록. 대소문자 형식이 동일해야 하는 사용자 지정 링크 이름을 포함할 수 있습니다 (“Staff Link” = “Staff Link”).
show these links for logged-in only 로그인 사용자만 표시할 링크 목록. 대소문자 형식이 동일해야 하는 사용자 지정 링크 이름을 포함할 수 있습니다 (“User Link” = “User Link”)
show more for staff only 직원만 ‘더 보기’ 드롭다운 섹션을 표시하도록 하는 체크박스.
show more for logged-in only 로그인 사용자만 ‘더 보기’ 드롭다운 섹션을 표시하도록 하는 체크박스.
show custom for anon only 익명 사용자만 표시할 사용자 지정 메뉴 섹션을 위한 텍스트 필드(로그인 사용자에게는 숨김).
show navigation menu to logged-in only 전체 네비게이션 사이드바 메뉴를 로그인 사용자만 표시하도록 하는 체크박스(익명 사용자에게 숨김).
hide custom menus globe icon 직원용 사용자 지정 메뉴 섹션에서 지구본 아이콘을 숨김(기본적으로 비직원에게는 표시되지 않음).
default menu section ordering 기본 메뉴 섹션의 순서를 재배열할 수 있습니다(사용자 지정 메뉴에는 적용되지 않음)

스크린샷

직원 및 로그인 사용자 전용 섹션 설정

직원 및 로그인 사용자 전용 링크 설정

더 보기 섹션, 익명 사용자 전용 사용자 지정 메뉴 섹션, 지구본 아이콘, 전체 네비게이션 메뉴 숨김, 기본 메뉴 섹션 순서 변경 설정


그룹별 네비게이션 사이드바 메뉴 섹션을 사용자 지정하려면 Group Menu Sections 테마 컴포넌트를 사용하세요.

24개의 좋아요

Added a section to allow re-ordering of the default menu sections.

5개의 좋아요

I don’t think the hiding links thing is quite working correctly at the mo.

Sections hide just fine for me, but I can’t hide individual custom links when I convert them to lowercase and dashes.

But the official links seem to need lowercase. So they might be handled differently.

However - they work if the full title text is used (with spaces and capitals). So maybe only the OP (can it be wikified?) and the instructions in the TC need to be changed. Or maybe a core change is needed for consistency.

2개의 좋아요

thanks Nathan. yea something has changed there. will have a look at this over the weekend.

1개의 좋아요

Ok the component is still functioning properly, but the custom link class name format has changed so I had to make some changes to the field documentation in the component and the OP. Please update the theme component.

Unlike the custom menu sections, for the custom links, the names in the component settings should be the same case format as their actual custom names. Of course the default ones should still be lowercase just to make things even more confusing lol. :grin:

For example, if I want to show a specific custom link called “GitHub Repo” for logged in users only:

I would enter the same link name in the show these links for logged-in only setting in the theme component:

So if you have custom links in the links display settings - show these links for staff only and show these links for logged-in only - you will need to change those component settings entries to match the link names.

Note that for custom menu sections (not links), the naming convention is still the same as it was before - it is still lower case slug style (ie: “Custom Menu Name” = custom-menu-name).

Thanks again for bringing this to my attention @nathank :hugs:

At some point I want to add the ability rearrange all the navigation sidebar menu sections, including custom ones, not just the default ones as it does currently. I know how to do it in hardcode, I just have to build it in to use settings and variables.

5개의 좋아요

Hey Lilly,

I’m noticing:

  • I can’t reorder sections regardless of whether I use the human name or the slug
  • The whole sidebar gets hidden for guests even when I haven’t checked that box
1개의 좋아요

You can’t re-order custom sections with this component. I just checked the reorder functionality and it is working as expected.

Yea I can confirm the anon-hiding function is borked. I will fix it today. thanks for letting me know.

after looking ati it, the anon hiding function is working as expected, but you have to remove the default examples that I use in the settings for the show these sections for logged-in only to demonstrate how it works.

1개의 좋아요


Not displadisplay anyone with not logged mode?

That should be a toggle setting…

image

1개의 좋아요

see my post above yours :slight_smile:

edit: perhaps I should consider removing those and just use the screenshot to show. :thinking:

4개의 좋아요

Ok I have done this now and edited the OP. Use the screenshots as a guide for default section and link names.

2개의 좋아요

I think that the CSS for the ⋮ More section has changed (btn-flat is no more)

I’ve had to use this to hide it for anon:

.anon button.sidebar-more-section-links-details-summary {
    display: none;
}

Here is a PR:
https://github.com/Lillinator/navigation-menu-display-control/pull/7

3개의 좋아요

This has been merged. thanks again Nathan :hugs:

I also fixed the hide entire sidebar for anon function which was a bit broken.

4개의 좋아요

Hi there,

Im stuck, while trying to comprehend how to use this nice component. Im trying to achieve that anon users only see “Become a member” or something similar.
Can you please help me?

I’ll give you 3 different ways to do this:

1. Use this theme component

Make a custom sidebar menu with the link to /login and use this setting in the theme component:


2. Use CSS in a new/exsiting theme or component

If you just want to add a link in the top section under My Posts, you can add the link to /login via the More - Customized this section link like this. For example if the link is called “Login or Signup”:

Then go to a theme or theme component and edit the html / css like so:

Keep in mind that the link references in that top section are case sensitive:

.sidebar-section-link-wrapper[data-list-item-name="Login or Signup"] {
  display: none;
}

.anon .sidebar-section-link-wrapper[data-list-item-name="Login or Signup"] {
  display: block;
}

result in incognito / anon view:


3. Use the following theme component

Yes I made a specific theme component ages ago that does this. It also does the reverse - displays a section for members only (logged in users).

4개의 좋아요

got it. Thank you very much for the detailed guidance.

2개의 좋아요