3

Hiding Report Tab Using Javascript

Hello,

We have a need to hide the "Reports" tab from view, and Zendesk support said that we would need to use Javascript to do so. Is there anyone that has come across this problem and can help us solve it? My problem specifically is that there do not seem to be any associated ID or NAME tags to use in scripting?

Any help would be most appreciated.

30 comments

  • 0

    Hi there,

    Are you trying to hide it from all users or just from Agents?

    Jake Holman
    Zendesk Support

  • 0

    Thanks for the reply.

    We are trying to hide from everyone, as it's a feature we don't use. We have an agent who is only able to view members of a certain group but the reports section allows them access to statistics from the entire account.

  • 0

    Hey William,

    Try adding this code to a Global JavaScript Widget:  http://www.pastie.org/663316

    I've not tested it extensively, but it should work fine :)

    Jake Holman
    Zendesk Support

  • 0

    Jake,

    Many thanks for that, works a treat!!!

    Will

  • 0

    Hey guys, I have no javascript experience.  How would that script be changed if I'm just trying to remove the "submit a ticket" option, but keep the "check on my ticket status" option?  I want to direct my users to use a dropbox that asks specific questions based on closest forum topic.  Thanks.

  • 0

    @Jayesh: Replace the /reports with /requests/portal/new - this shouldn't prevent you from creating new tickets (at least I hope not).

    _Jake Holman
    _Zendesk Support

     

  • 0

    Thanks.  Also, you need to code for anonymous user, so my widget looks like:

     

    Event.observe(window, 'load', function() { $$('a[href="/requests/anonymous/new"]').each(function (e) { Element.hide(e.parentNode); }); }); Event.observe(window, 'load', function() { $$('a[href="/requests/portal/new"]').each(function (e) { Element.hide(e.parentNode); }); });

  • 0

    I used Jayesh's code on Friday to solve my concern (email only help desk) but now tonight it's not working anymore. I checked on firefox and IE. Did something change?

  • 0

    Yes, the JavaScript widgets we were using to hide the "Submit a Request" and "Check Existing Requests" broke recently... I assume with the Zendesk release this past weekend.  After a bit of fiddling, I have been able to "re-hide" all tabs for agents and logged in users.  For anonymous users, I have been able to hide the "Submit a Request" tab with this code:

     

    Event.observe(window, 'load', function() {

        $('a[href="/anonymous_requests/new"]').each(function (e) { Element.hide(e.parentNode); });

    });

    Event.observe(window, 'load', function() {    $('a[href="/anonymous_requests/new"]').each(function (e) { Element.hide(e.parentNode); });});

    However, I can't figure out code to hide the "Check Existing Requests" tab for anonymous users.  For reference, here is the code that removes existing requests for logged in users and agents:

    Event.observe(window, 'load', function() { $$('a[href="/requests"]').each(function (e) { Element.hide(e.parentNode); });});

     

  • 0

    darn it... i can't edit my comment to remove the typo :(

  • 0

    OK, this successfully removed the "check existing requests" for anonymous users (note that it contains our specific zendesk url so it will need to be modified for general consumption):

    Event.observe(window, 'load', function() { $('a[href="/login?return_to=http%3A%2F%2Fsinglefeed.zendesk.com%2Frequests"]').each(function (e) { Element.hide(e.parentNode); }); 

  • 0

    Hello Colin & Jake : We'd like to create a widget that allows us to do the following:

    1. Hide the Submit a New Request from the top nav on any page

    Can you all help? It seems to be what you are doing? We're only temporarily looking to hide ticket creation, which we recognize is a  strange while using ZenDesk.

    Thanks!

    Mark

  • 0

    Event.observe(window, 'load', function() {

    if ($('#top-menu #green .tab_new')[0]){

       $('#top-menu #green .tab_new')[0].hide('<a href="/requests/portal/new" class="tab">Ask A Question</a>')

    if ($('#top-menu #green .tab_requests')[0]){ Event.observe(window, 'load', function() { if ($$('#top-menu #green .tab_new')[0]){ $$('#top-menu #green .tab_new')[0].hide('<a href="/requests/portal/new" class="tab">Ask A Question</a>'); }

    if ($$('#top-menu #green .tab_requests')[0]){ $$('#top-menu #green .tab_requests')[0].hide('<a href="/requests" class="tab">what ever you want</a>'); }});    $('#top-menu #green .tab_requests')[0].update('<a href="/requests" class="tab">what ever you want</a>')

    }

  • 0

    I'm currently trying to hide these same tabs from my page and I tried using this code

    Event.observe(window, 'load', function() {
    if ($('#top-menu #green .tab_new')[0]){   $('#top-menu #green .tab_new')[0].hide('<a href="/requests/portal/new" class="tab">.</a>');}

    if ($('#top-menu #green .tab_requests')[0]){   $('#top-menu #green .tab_requests')[0].update('<a href="/requests" class="tab">..</a>');}
    });

    The widget is not working, and my firefox error console reads, "$('#top-menu #green .tab_new') is null.

    Does anyone have any ideas or suggestions as to what my problem could be?

  • 0

    Hi Nancy,

    I took a look at your code and updated it. I have also updated the answer on this topic. Thanks for letting us know.

    Skip
    Zendesk Support 

  • 0

    Thanks for the help Skip, that worked!

  • 0

    Would you or anyone else also happen to have the code to remove the first two tabs on the bar and the bar itself? I would like to collapse the whole bar, if possible

  • 0

    Skip,

    I tried your code, which successfully hides the "Submit a Request" and "Check Your Existing Requests". However, it doesn't add the replacement links, "Ask a Question" or "whatever you want". 

     

    I'm pretty much Javascript illiterate, and help you can give is much appreciated.

  • 0

    OK, so code which hide reports tab from all users works fine. I'm not very familiar with Java so I would like to ask is there a way to hide a reports tab from agents? I would like my reports to be visible only to admins.

     

    Thanks in advance

    Piotr

  • 0

    Hi I would like to remove "check your existing requests" tab globally for all user types. How can i do this? I tried using collin's suggestion in a global javascript widget but not working

     

    Event.observe(window, 'load', function() { $('a[href="/login?return_to=http%3A%2F%2Fasiaclassified.zendesk.com%2Frequests"]').each(function (e) { Element.hide(e.parentNode); });

  • 0

    For global use, seemed easiest to just use CSS. Plus, there's no jilting on page load:

    #green .tab_requests,
    #green .tab_new {
        display: none;
    }

  • 0

    I tried using the CSS solution above to hide the "Home" tab....but it also hides the "check my existing requests" tab for logged in users!

     

    My CSS reads as follows:

     

    #green .tab_requests,
    #green .tab_new {
        display: none;
    }

     

    Any thoughts?

  • 0

    I ended up using javascript after all....

     

    Event.observe(window, 'load', function() { $$('a[href="/home"]').each(function (e) { Element.hide(e.parentNode); }); }); Event.observe(window, 'load', function() { $$('a[href="/home"]').each(function (e) { Element.hide(e.parentNode); }); });

     

    Worked like a charm! (but I think I've got some overkill code here....corrections welcomed)

  • 0

    We'd like the ability to hide "submit a request" to specific users.  These users would be part of an organization that is tagged as "free users" and they would be able to post/reply/comment on forums but not submit support requests. 

     

    How would I modify the javascript to hide it for a specific organization and subsequent users? (this is a big deal for us so thank you for any help you can relay!)

  • 0

    Hi, Andrew -

    I can't say for sure, but it seems to me it would be a little more difficult to hide this tab from just one organization. If you hid it from just that one organization, it would still be visible to users who are not logged in at all, and if you're using org as your method for hiding this, since users who aren't logged in have no organization. I think there might be some better options, so I sent you a ticket so we can discuss. Thanks!

  • 0

    @Max - I am looking to implement the same functionality that Andrew had mentioned above with respect to "free users". Was there ever any conclusion to this? 

  • 0

    Hi, Duke -

    Same answer, essentially. If you're looking to hide the tab, you can hide it from everyone using Javascript, but hiding it from just one organization is challenging because it will still remain visible to people who are not logged in. There is a much more in depth discussion of hiding and showing tabs based on a user's org here: https://support.zendesk.com/entries/175801-show-or-hide-tabs-based-on-organization

  • 0

    The above Javascript solution worked to hide the "home tab, but because the script is loading last, I still see the tab there for a second before it dissapears.  Is there any way to globally remove the home tab but not have it flash like it currently is?

     

    Thanks

  • 0

    @Chris: You could go down the CSS route instead. Add this to a CSS widget and you shouldn't see the flashing:

    #top-menu .tab_home { display: none; }

  • 0

    Thanks Jake!  I had added just  .tab_home { display: none; }  which didnt work... thanks for pointing out the correct selector to use, much appreciated.

     

Please sign in to leave a comment.