Hide and show My Activities and Submit a Request (Help Center) Follow

Comments

26 comments

  • Avatar
    Marybeth Sklar

    How can I hide the home page search bar from unauthenticated users? We check to see if a user is anonymous and present a notification if they are (thanks Wes). Now I'd like to hide the search bar, because we're getting 0 results returned for search terms due to unauthenticated users trying to search. Here's what Wes helped craft in JS:

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

        $('.notification').slideDown('fast'); 
    

    }
    Thanks in advance.

  • Avatar
    Thibault

    It seems the function HelpCenter.user.organizations. can not be used anymore ?

    Is it a side effect of the new helpcenter ? if yes, then what to replace it ?

  • Avatar
    Toni Delli Compagni

    Hi,

    I'm trying to hide the 'my activities' button.  Our company does not use tags for our end users, we would like to hide the button from all our users.

    I think I have followed the instructions correctly, I've only used the CSS code provided above, not used the JS at all as we don't use tags.  When viewing the Help Centre in editing mode, the button is not visible: http://screencast.com/t/OeaY7dg3 But when viewing the live site the button is visible: http://screencast.com/t/muZHSYHm1fh

    Please can you let me know where i have gone wrong?  I'm not very experience with CSS, so please go slow....

    For now, I have set out Help Centre to Set-up Mode

    Thanks,
    Toni

  • Avatar
    Toni Delli Compagni

    Got it!  It helps to publish the change.  Thanks again for the tutorial above

  • Avatar
    Jessie - Community Manager

    I'm glad you were able to get it working, Toni!

  • Avatar
    Rafael Cueto-Felgueroso

    Hi, 

    I've put this code in the JS section of the main page:

     

    (function() {

    var isUser = false;

    HelpCenter.user.tags.forEach(function(x) {

    if (HelpCenter.user.tags=="usertag") {

    isUser = true;

    }

    });

    // Checks if the tag was found or not

    if (isUser === true) {

    alert('I have the tag you are looking for!')

    }

    else{

    alert('I have a different tag!')

    }

    }());

     

    But it does not work. Puting alerts along the code I see it breakes in the follwing line:

    HelpCenter.user.tags.forEach(function(x) {

     

    Any idea?

     

    Thanks,

     

    Rafael C:

     

  • Avatar
    ServiceDesk

    You have to put the code after :

    /*
    * jQuery v1.9.1 included
    */

    $(document).ready(function()
    {

     

    If you put it before, it wont' work.

  • Avatar
    Rafael Cueto-Felgueroso

    Oh, my God, I'm ashamed... Thanks a lot, it works fine now!

  • Avatar
    ServiceDesk

    No prob. I'm happy it's solved your problem. Have a nice day.

  • Avatar
    Micah Adamson
    FYI:
    We were able to duplicate the customization to prevent unpaid customers from seeing the "+ Submit a Request" button in the Help Center to hide another way for unpaid customers to open a service request from the directly link to https://<company>.zendesk.com/hc/en-us/requests/new published in our app.
     
    Here are the steps we used to hide the support request form based on the paid customer tag:
    • Added: id="requestForm" - inside the <div class="form"> tag in the New Request Page:
       <div class="form" id="requestForm">
    • Added: #requestForm - to the list of elements to hide in CSS:
       a[href$='requests/new'], a.submit-a-request, .my-activities, #user-menu .my-activities, #requestForm {
             display: none;
          }
    • Added: $('#requestForm').show(); - to the list of elements to hide in JS:
       if (isCust === true) {
        $('a[href$="requests/new"]').show();
        $('.my-activities').show();
        $('#user-menu .my-activities').show();
        $('a.submit-a-request').show();
        $('#requestForm').show();
        }
    • Added: A note to the bottom of the New Request Page saying:
       "Please confirm you are signed in with your account to open a support request and see the following article for more information about if you are eligible to open support requests."
  • Avatar
    Tara

    Would it be possible to extend this to only user specific tags?

    We have our help center restricted to authenticated users, but would only like dedicated champions within a customer's account to be able to submit tickets - all users for that organization can search the help center though.

  • Avatar
    Stan Sims (Edited )

    @Tara

    Based on your description, I'm doing something similar.  I'll paste it below.  

     

    (function() {
    // find the tag in the array
    function isOrgTicketRestricted(element, index, array) {
    return (element === 'restricted');
    }
    function isOrgTicketOverriden(element, index, array) {
    return (element === 'override');
    }

    var orgArray = HelpCenter.user.organizations;
    var user = HelpCenter.user;
    if (orgArray.length === 1) {
    orgName = orgArray[0].name;
    //hide ticket entry options for users part of restricted organization who don't have the override tag
    if (orgArray[0].tags.some(isOrgTicketRestricted) && !(user.tags.some(isOrgTicketOverriden))) {
    //alert('Hide my options')
    $('a[href$="requests/new"]').hide();
    $('.my-activities').hide();
    $('#user-menu .my-activities').hide();
    $('a.submit-a-request').hide();
    }
    //show ticket entry options in all other cases
    else
    {
    //alert('show my options')
    $('a[href$="requests/new"]').show();
    $('.my-activities').show();
    $('#user-menu .my-activities').show();
    $('a.submit-a-request').show();
    }
    }
    }());
  • Avatar
    Tara

    Thanks Stan, so how would this work, we need to add a 'restricted' tag to every organization then add an 'override' tag to the users that we want to allow ticket submission?

  • Avatar
    Stan Sims (Edited )

    Yep, you got it!  Also, another note regarding the code above is that it only applies to users who are part of one and only one organization.  I assume if a user is part of multiple organizations then they don't need links/buttons hidden.

  • Avatar
    Reno Van Boven

    Hey,

    Somehow this code is no longer working? It no longer shows the "Submit Request" to our customers any longer.. (It worked a few days back)

    Cheers,

    Reno

  • Avatar
    Nicole - Community Manager

    Hey Reno -
    I checked in with Skip and he said there haven't been any changes to the code. Has anything changed in your system in the last few days?

  • Avatar
    Reno Van Boven

    Hey Nicole, 

    Thanks for the response.

    Apart from updating a few triggers to the ticket processing, nothing else has changed.. It was working about a week ago.

    I'll dig a bit more to see what could cause it..

    Cheers,

    Reno

  • Avatar
    David (Edited )

    This worked fine for me, just not according to organization tag but user tag. When the user had the appropriate tag the link button appeared, but when I removed the user tag, the link was invisible, even though the organization had the same tag...

     All I did was copy the code from above, and replace "paying" with my tag.

    Can someone explain this?...

     

    UPDATE turns out the results weren't effective until i logged out and then back in again. Then the link was displayed/hidden according to org tag

  • Avatar
    Jessie - Community Manager

    Hi David! I'm glad you got it working!

  • Avatar
    Diego J. Argibay

    Hi everyone,

     

    is it possible to hide when a customer belongs to 2 organizations? 

     

    Thanks

  • Avatar
    Jessie - Community Manager

    Hi Diego!

    Where are you looking to hide this information, and from whom?

  • Avatar
    Diego J. Argibay

    Hi Jessie, 

    when a customer logs in, I have added a phone number where they can reach us on the top-right, where the login info appears. I want to hide this number for some customers that belong to 2 different organizations. Is it that possible?

  • Avatar
    Nicole Korp

    Hi Diego!

    Yes, it is possible to hide that number for customers who belong to 2 different organizations. If you add tags for each of those organizations, you can look for both organization tags rather than just one. You would need to slightly edit the code provided in this article, but it is possible.

    Let me know if you have any questions!

  • Avatar
    Albert Aguilar

    Can I hide the "Sign In" from the Help Centre

     

  • Avatar
    Vladan Jovic

    Hey Albert, probably the easiest way to do that, just paste this code at the end of your theme CSS file.

    a.login {
    display: none;
    visibility: hidden;
    }
  • Avatar
    Scott Russo (Edited )

    I add the following code, and the page displays correctly in Preview mode, but when I publish and go to the web site directly, I still see the "Submit a Request" link. Do I place this code segment on line one of the style.css file, above the existing code?

    /* ====================================================
       things to hide at start up
       ==================================================== */  
       a[href$='requests/new'], a.submit-a-request, .my-activities, #user-menu .my-activities {
         display: none;
       }

     

     

Please sign in to leave a comment.

Powered by Zendesk