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

Comments

17 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
    Julien

    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
    Julien

    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

Please sign in to leave a comment.

Powered by Zendesk