Skip to content

Instantly share code, notes, and snippets.

@skipjac
Last active December 23, 2015 23:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skipjac/6709976 to your computer and use it in GitHub Desktop.
Save skipjac/6709976 to your computer and use it in GitHub Desktop.
Show and hide the "My activities" and "Submit a request" in Zendesk HelpCenter based on Organization tags. Place the code from the hideElements.css in the CSS tab of the theme page. And place the code from showElements.js in the JS tab right after the line ``` $(document).ready(function() { ```
/* ====================================================
things to hide at start up
==================================================== */
a[href$='requests/new'], .my-activities, #user-menu .my-activities {
display: none;
}
(function(){
var isCust;
function isCustomer(element, index, array){
return (element === 'paying');
}
HelpCenter.user.organizations.forEach(function(x){
isCust = x.tags.some(isCustomer);
return (isCust === true);
});
if(isCust === true){
$('a[href$="requests/new"]').show();
$('.my-activities').show();
$('#user-menu .my-activitis').show();
}
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment