How can I hide or show HTML based on user's role or group?

Return to top
Have more questions? Submit a request


  • Jeremy Robinson
    Community Moderator

    Aaron - one last bit, that we did when we went through a user tag phase for our beta rollout of the community aspect in Zendesk was the bulk update with CSV for users, that way we didn't have to manually go in and update one at a time. 

  • Brett Bowser
    Zendesk Community Team

    Thanks for sharing this solution Jeremy!

  • Jean-Baptiste Hennion

    Hello ! This oslution seems to not work anymore with the new template version !


  • Simon Agliati

    Does anyone know how to show/hide based on a users role by using Curlybars if statements? Is this possible?

  • Kay
    Community Moderator

    Simon Agliati the only way to do that is documented above here.

    // Show div html based on role
    if (HelpCenter.user.role=="anonymous"){

    if (HelpCenter.user.role=="end_user"){

    if (HelpCenter.user.role=="agent"){

    if (HelpCenter.user.role=="manager"){
  • Ron de Vries


    Does anyone have any experience or knowhow how to show the Community for a specific User Segment only? I have a User Segment ''Staff'' which are the employees or our company. Since we first want to roll-out the Community internal I am looking for a way to have it shown only to that specific User Segment. I do think the User Segment has an ID, maybe I can target that using JavaScript?

    Any help is much appreciated. Thanks and have a great New Year!


  • Nicole S.
    Zendesk Community Team

    Hi Ron, 

    All you need to do is set the visibility of all of the topics in your community to that internal user segment. 

    You may need to hide the link to the community from en-users on your Help Center with a little custom code, otherwise they'll click it and show up to an empty community. Then just make sure you give your employees a direct link to the community as they won't be able to navigate to it. 


Please sign in to leave a comment.

Powered by Zendesk