Recent searches


No recent searches

Hide Component Based on Role



Posted Apr 02, 2024

Hello! I am looking to hide recent_activity on the homepage based on the user role.  I do not want end-users to see this section, but leave it in place for Agents and Admins.  Any ideas on how to accomplish this?


1

1

1 comment

image avatar

Pulkit Pandey

Zendesk LuminaryCommunity Moderator

Hi Alek

 

Please go through the following steps to hide the recent_activity on the homepage for end users and available for the Agents and Admins.

1. Go to the home_page.hbs file and search for the following “{{recent_activity}}” and then add the “hide” class on its wrapper.

 

 

 

2. Then go to the script.js file and add the below code at the bottom 

if (HelpCenter.user.role=="agent"){
    document.querySelector(".home-section.activity").classList.remove("hide");
 }
 if (HelpCenter.user.role=="manager"){
     document.querySelector(".home-section.activity").classList.remove("hide");
 }

 

3. Add the below CSS at the bottom of your style.css file 

 

.hide {
  display: none;
}

 

 

Let me know if it solves your issue 

 

 

Thank You 

 

Pulkit

 

Team Diziana

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post