Restrict Custom block at home page based on user group

15 Comments

  • Jennifer Rowe
    Zendesk Documentation Team

    Thanks, Diziana! You know we always love your tips!

    1
  • Joe Palmieri

    Hi there,

    When 'lurking' around in the source code, I found this message, right above the declaration of the HelpCenter.user object:

    We also use this object's values to restrict content based on users (e.g., only show feature x to authenticated users).

    Is this note still accurate? In other words, should we be worried about the HelpCenter.user object being removed in the future (and thus breaking our current Help Center's functionality)?

    The above code is from an inline script included in the html of https://[brand].zendesk.com/hc/en-us

    0
  • Jessie Schutz
    Zendesk team member

    Hi Joe!

    The note is accurate. It doesn't necessarily mean that anything is going to change, but we can't promise that changes won't happen as Zendesk continues to grow and evolve. We don't want your stuff to break in the event that happens because we won't be able to help you fix your customizations, which is why we put the note there.

    Please let me know if you have other questions, or need any further clarification!

    0
  • Joe Palmieri

    Thanks, Jessie! Totally makes sense. We'll use this cautiously and won't blame you if it ever changes :)

    0
  • Tobias Eriksson

    Thank you! Been looking for a way to do this a couple of days now!!! Cheers!

    I changed the JS from <li> to <p> and it looks like it works as well! 

    0
  • Diziana

    @Joe: It's good idea not to use any undocumented stuff, we try not to. We are working to find a way to replace code which uses HelpCenter object anywhere.

    0
  • Diziana

    @Tobias: We are glad that it helped you.

    @Jennifer: Where is our goody for the tip? ;-)

    0
  • Jennifer Rowe
    Zendesk Documentation Team

    Hey Diziana,

    I sent you something via email a few months back, but it looks like it was never redeemed. Email me at community@zendesk.com and I'll give you the link again! You've definitely earned it. :)

    0
  • Jean-Michel WEISS

    Hi,

    HelpCenter is an undocumented object, i know that the HelpCenter.user.tags exists, do you know if HelpCenter.organization.tags exists, and if there is a hidden link where i can get all the arguments that i can use, like the place holder ? it would be nice

    0
  • Jimmy Lin

    Hey Jean-Michel WEISS -

    You can type HelpCenter into your browser console on a Zendesk Help Center page and see the results for yourself.  I just did it now while typing out my comment and I do see that my organizations and the organizations tags are listed.  So you should be able to get the data as well.

    0
  • Jean-Michel WEISS

    Not working on my side, Jennifer Rowe, an idea ? anyway thanks for the advice

    0
  • Bryan - Community Manager
    Zendesk Developer Support

    Hello Jean-Michel WEISS -- organizations are at the user level of the HelpCenter object -- it looks like you may be checking at a higher level (HelpCenter.organization.tags):

    0
  • Jean-Michel WEISS

    on my side, there is no HelpCenter.organization, only HelpCenter.user.organization, any idea ? thanks again

    0
  • Bryan - Community Manager
    Zendesk Developer Support

    You're right. There is no HelpCenter.organization value. The organization information is tied to the signed-in user. If you need the overall set of Organizations for an account, you'll want to call the GET /api/v2/organizations.json API.

    0
  • Eric Miller

    Any reason the instructions provided by the original poster would not work today? (It was written 5 years ago). I tried the instructions but it doesn't seem to work correctly. Simply placing the JS code in my JS file breaks the formatting of my home page and I can't scroll the entire page properly. Anyone know what the best current way would be to restrict a custom block on the home page by user group?

    0

Please sign in to leave a comment.

Powered by Zendesk