Recent searches


No recent searches

How can I hide post follow button to the specific users

Answered


Posted Jul 25, 2021

How can I hide post follow button to the specific users ?


0

12

12 comments

image avatar

Ifra Saqlain

Zendesk LuminaryMost Engaged Community Member - 2022Most Engaged Community Member of The Year - 2021Community Moderator

You can hide post follow button for specific user by checking the user role in the help centre.

I am using default Copenhagen Theme.

Here, you are hiding the post follow button to the end_users,

you need to edit the script.js file, 

copy the below code and paste at the script file but inside the DOM function.

  if(HelpCenter.user.role==="end_user") {
var postFollowButton= document.querySelector('.post-container .community-follow'); //may be you have any different class
postFollowButton.style.display = 'none';
}

 

Screenshot for the same:

 

 

 

Output is:

 

Showing for agent role

 

 

Showing for admin role

 

Not showing for end user - because you are hiding the button only for end-users

 

 

 

To hide for more users:

  if(HelpCenter.user.role==="end_user" || HelpCenter.user.role==="agent") { //add more users role 
var wrapper = document.querySelector('.community-follow');
wrapper.style.display = 'none';
}

 

Or

If any bug after adding the code, you can add the given code in your theme and set that as live and share the public URL here so  I could be able to figure out the bug.

 

Thanks

 

0


Thank you , It worked..

0


I am adding Admin in user role if(HelpCenter.user.role==="end_user") but nothing happened. Am I doing wrong?

0


image avatar

Ifra Saqlain

Zendesk LuminaryMost Engaged Community Member - 2022Most Engaged Community Member of The Year - 2021Community Moderator

@Mohd Alam Ansari, try this:

 if(HelpCenter.user.role==="manager")

Whenever you woul check the role of admin, add the manager in the condition.

Screenshot for the same:

 

Thanks

 

 

0


Thanks a lot Ifra, I am beginner and I have lots of basic questions to ask but I am confuse from where to start. I have copenhagen theme but I am messed up.

 

0


image avatar

Ifra Saqlain

Zendesk LuminaryMost Engaged Community Member - 2022Most Engaged Community Member of The Year - 2021Community Moderator

Okay, take a long breath, not to worry.

Follow the given simple steps below:

1). Make sure you know about the HTML and CSS or basic level HTML and CSS. If not, then learn daily in a little-little part on  https://www.w3schools.com/css/

and do practice daily without taking any stress (messed up with or etc).

2). Just take the learning part as Jumanji. Once you have done with the HTML and CSS then ready to go to next level.

 

Important Documentations:

https://support.zendesk.com/hc/en-us/articles/206177737-Branding-your-help-center

https://support.zendesk.com/hc/en-us/articles/203664426-Help-center-CSS-cookbook

https://support.zendesk.com/hc/en-us/articles/203664326-Customizing-your-help-center-theme

 

when you have done the above documentations then go ahead with the further steps.

 

3). If you know about HTML and CSS and have been learn about those Branding, CSS identifiers meanwhile when you have done with above points then it's very good thing for you. 

4). Now just play with code, remove the default already added helpers and see what's changing on the template.

5). Open the Copenhagen theme with preview Mode and see the changes after removing any helper from the homepage. Spend some time with these things. If any question you have then feel free to

 

 

 

Zendesk themes are using handlebar but when you inspect the code in the dev tool you will get HTML structure.

6). Open the dev tool on the window: right click of your mouse > would be open the list as in screenshot > select Inspect at the last of list

 

 

7). Now the view is:

 

I wish this article should be helpful for you. Don't go with any hard things like add conditions and check user role, change logo URL etc. just start with simple basic things.

 

Thanks 

 

 

0


mentioned guidance is good for beginners

0


Thanks for the guidance,
If I want to add custom font family, which way do I have to follow?

0


image avatar

Ifra Saqlain

Zendesk LuminaryMost Engaged Community Member - 2022Most Engaged Community Member of The Year - 2021Community Moderator

Hi,

Go through this article: https://support.diziana.com/hc/en-us/articles/360006856179

 

If any confusion let me know.

Thanks

0


Thanks.
Video is good than the article.

0


I am confuse about something. Can you please share those all as a video?

0


image avatar

Ifra Saqlain

Zendesk LuminaryMost Engaged Community Member - 2022Most Engaged Community Member of The Year - 2021Community Moderator

Ringing....... 

 

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post