Need To Hide Help Category Block from End-Users Only
Hey all,
I need help hiding a block from end-users and only allow it to be seen by Agents.
The 'Agent Knowledge Capture' block is for internal use only. We need this hidden from end-users, as it can currently be seen by all viewers and generates the following message when selected by end users, which we want to avoid:
Many thanks for assisting.
-
Hi Owen, Follow these simple steps to achieve this:
Step 1: To get category-ID so need to add this category-id-{{id}} inside your category block's code on your home_page.hbs.
{{#each categories}}
{{#if ../has_multiple_categories}}
<li class="blocks-item category-id-{{id}}"> // To get category-ID category-id-{{id}}
<a href='{{url}}' class="blocks-item-link">
<span class="blocks-item-title">{{name}}</span>
<span class="blocks-item-description">{{excerpt description}}</span>
</a>
</li>
{{else}}
{{#each sections}}
<li class="blocks-item">
<a href='{{url}}' class="blocks-item-link">
<span class="blocks-item-title">
{{name}}
</span>
<span class="blocks-item-description">{{excerpt description}}</span>
</a>
</li>
{{/each}}
{{/if}}
{{/each}}Step 2: Copy the below code and paste at your script.js file.
if (HelpCenter.user.role=='end_user') {
var specificcategory = document.querySelector('.category-id-60002934000'); // This bold number is the category ID, you need to update this as per your category ID.
specificcategory.style.display = 'none';
}Step 3: To get category ID, click on that and get the ID from search-bar eg.
https://xyz/hc/en-us/categories/60002934000-xyz
Now your specific category-block will be hidden to end-users.
-
Hey Owen Calvert
If you wanna hide the 'Agent Knowledge Capture' from the end-user you just need to make that category to draft then that category will only visible to the Agent and Admin users
Hope this will work for you
Thanks
サインインしてコメントを残してください。
2 コメント