How to hide an article from an anonymous user?
답변함Hello,
Can someone please help me with below request?
The reason been that I would only like an end user to have access to this article is if the link is sent to them in a macro by an agent.
I can't put the article as visible to agents and managers because then the end user would have to sign in to view link from the macro they were sent.
I tried using this code in my Script.JS page - the value is the article number
if (HelpCenter.user.role=="anonymous")
{
$('#request_issue_type_selectoption[value="360044879213"]').remove();
$('.nesty-panel').on('DOMNodeInserted', function(e) {
$(this).children('ul').children().remove('#360044879213');
});
}
Kind Regards,
Anton
-
Hey Anton,
Add the given JS code at the bottom of your script file for hiding the specific article from anonymous user:
$(document).ready(function(){
if (HelpCenter.user.role=="anonymous"){
$('a[href*="360038927111"]').attr('href','https://example.zendesk.com/
hc/en-us/articles/360038927111-What-are-these-sections-and-articles-doing-here-').hide();
}
})For hiding article from Manager and Agent , you can add users in the IF condition like:
if (HelpCenter.user.role=='anonymous' || HelpCenter.user.role == 'manager' || HelpCenter.user.role== 'agent'){
You need to update article URL and article ID here:
$('a[href*="360038927111"]').attr('href','https://example.zendesk.com/
hc/en-us/articles/360038927111-What-are-these-sections-and-articles-doing-here-').hide();Also please read this article:
https://support.zendesk.com/hc/en-us/articles/225031208-Setting-view-permissions-on-articles-with-user-segments
If any query or confusion let me know :)
Thank You
-
Hello Ifra,
This works. Thanks for your help.
You might know the answer to the question. Say for example a customer picks no in the box below in a specific article can you make it direct to a specific form for them to fill out?
Kind Regards,
Anton
-
Hi Anton,
Yes, you can do it simply. See how I played with the code:
{{vote 'up' role='radio' class='button article-vote article-vote-up'}}
{{#isnt id 360038927091}}
{{vote 'down' role='radio' class='button article-vote article-vote-down'}}
{{/isnt}}
{{#is id 360038927091}}
<a class='button article-vote article-vote-down' href="https://support.zendesk.com/hc/en-us/community/posts/360039664073-Bullet-points-disappearing-and-aligning-articles-in-a-border">
No
</a>
{{/is}}See in the image:
Step 1: I checked the article ID:
{{#isnt id 360038927091}} // used isnt for hiding the defualt 'No' button on specific article
Step 2: Created the custom 'No' button for a specific article:
{{#is id 360038927091}}
<a class='button article-vote article-vote-down' href="https://support.zendesk.com/hc/en- us/community/posts/360039664073-Bullet-points-disappearing-and-aligning-articles-in-a-border">
No
</a>
{{/is}}Step 3: The class name is the same, you can see in the full code for bolded class name.
This custom 'No' button will redirect to another page or any ticket ( your given URL here ).
This custom 'No' button would be show only on the specific article and the default 'No' button would be show on every article but not on that specific article. Please try this and if any issue then let me know :)
I believe you can apply this without any issue.
Thank You
-
Hello Ifra,
Thank you for the explanation.
Before I try this I'm assuming the code needs to be added to the article page?
Can I add it inside this div pn the article page or add it separately at the end?
<div class="comment-actions-container">
<div class="comment-vote vote" role='radiogroup'>
{{vote 'up' role='radio' class='vote-up' selected_class='vote-voted'}}
{{vote 'sum' class='vote-sum'}}
{{vote 'down' role='radio' class='vote-down' selected_class='vote-voted'}}
</div>Thank you.
Kind Regards,
Anton
-
Hello Ifra,
Thank you for the explanation.
Before I try this I'm assuming the code needs to be added to the article page?
Can I add it inside this div on the article page or add it separately at the end?
<div class="comment-actions-container">
<div class="comment-vote vote" role='radiogroup'>
{{vote 'up' role='radio' class='vote-up' selected_class='vote-voted'}}
{{vote 'sum' class='vote-sum'}}
{{vote 'down' role='radio' class='vote-down' selected_class='vote-voted'}}
</div>Thank you.
Kind Regards,
-
Hello Ifra.
I just tried this and it works.
Thank you for your help.
You might be able to assist me again. How do I get it to create a small pop up box to display a contact number if the customer picks No when the customer is asked is the article helpful?
Kind Regards,
Anton
-
My last message would be for all articles or if possible per article.
If you can explain for both scenarios please?
Thank you.
Kind Regards,
Anton
-
Hey Anton :) ,
Before I try this I'm assuming the code needs to be added to the article page?
Yes, this code is for the article page.
Can I add it inside this div on the article page or add it separately at the end?
Depends on your requirement where you need to customize. You can do like that for any button or div. The code I have given that is for the Yes and No button it could be done for vote-up and vote-down.
Thank You
Cheers
-
Anton,
Please go through this article.
You might be able to assist me again. How do I get it to create a small pop up box to display a contact number if the customer picks No when the customer is asked is the article helpful?
https://support.zendesk.com/hc/en-us/community/posts/360042122453-How-to-add-a-pop-up-box-when-yes-or-no-was-clicked-on-was-this-article-helpful
If any confusion or you want something different, feel free and let me know :)
Thank You
-
Anton,
Here,
My last message would be for all articles or if possible per article.
If you can explain for both scenarios please?
For all articles: For all article is like you know just go to the article page and customize the code or do anything. And changes would be shown in every article.
Per article and Specific article: It's for some specific article like you want to show something different only on a single article or two or three then you need to check the article ID and customize them. Results would be shown only on those specific articles, not on all articles.
You can do by using Label. Add labels while you creating the article and then you can check the label name and customize the article code. Results would be shown on those articles which have the label and you checked with the condition, not on all articles.
Thank You
-
Hello Ifra,
Thank you for your help.
Kind Regards,
Anton
댓글을 남기려면 로그인하세요.
11 댓글