Comments

14 comments

  • Avatar
    Craig Willis

    We use the following code to remove the submit a request based on the tags of the Organization and User that's logged in.

    This is in the JS page, when in Help Center Edit mode.

    // Limit access to Submit Cases and Live Chat to Administrators
    if((HelpCenter.user['tags'].indexOf("administrator") > -1 || HelpCenter.user['tags'].indexOf("internal") > -1 || HelpCenter.user['tags'].indexOf("partner") > -1)) {} else {
    $('a.submit-a-request').hide();
    $('#zenbox_tab').hide();
    zE(function() {
    zE.hide();
    });
    }

    You may be able to use $('a.submit-a-request').hide(); on it's own to remove it for everyone.

    Craig

  • Avatar
    Jessie - Community Manager

    Hey Alana!

    Adding custom code to your Help Center is the only way to hide the Submit a Request button. The code customization tools are only available on the Team plan or higher, though, so you would need to upgrade your plan to get access to them.

  • Avatar
    Ed Ball

    Hey Craig,

    This is what i was looking for, but i was hoping to do it based off the organizations only and not tags. I played with it a little, but to no avail. Javascript is not really in my wheelhouse right now. Is this possible? Seems possible if you can do off a tag, then why not just the org of the user.

  • Avatar
    Jessica Peck

    Thanks so much, this was exactly what I needed!  Another related question - I notice the 'Submit a Request' button is still present prior to login so a user that isn't tagged to be able to create can still click on that and then login and it takes them to the submit a request page.  Is it possible to hide the 'Submit a Request' prior to login?

  • Avatar
    Craig Willis

    Hi Jessica, 

    We have a private site so all users have to sign in so, unfortunately, I don't know how to achieve what you are looking to do.

    Craig

  • Avatar
    Trapta

    Hi @Jessica Peck,

    You can simply hide the submit_a_request component for all users and then once they are logged in, show them submit_a_request component if they have respective tags else they will not be able to see it.

    Thanks

    Team Diziana

  • Avatar
    Katie Swick

    Does anyone know if there is a way to disallow/remove "Submit a Request" for anonymous users only? Thus, allowing anyone signed in to create a request irrespective of tag, organization, etc?

    We want to make some pages of our KB totally "public" ... requiring no Zendesk registration, but I don't want those users to be able to submit a request.

    Thank all/anyone in advance for guidance!

    -Katie B

  • Avatar
    Jessica Peck

    @Katie, we did this via a template edit of the JS and place the below under the $(document).ready(function() {

    // Show div html based on role
    if (HelpCenter.user.role=="anonymous"){
    $('a.submit-a-request').hide();
    }

     

  • Avatar
    Trapta

    Hi @Katie Swick,

    As suggested by Jessica Peck, you can use JS to do this or you can simply use Zendesk {{signed_in}} helper to achieve this. Your code will look like -

    {{#if signed_in}}
     {{link 'new_request' class='submit-a-request' role='button'}}
    {{/if}}

    Thanks

    Team Diziana

  • Avatar
    Jo Saunders

    Hi @Trapta

     

    I'm trying to have it so that only logged in users are able to submit a request, I've pasted both the following codes onto JS but neither are working.

     

    {{#if signed_in}}
     {{link 'new_request' class='submit-a-request' role='button'}}
    {{/if}}

    and

    // Show div html based on role
    if (HelpCenter.user.role=="anonymous"){
    $('a.submit-a-request').hide();

    Can someone tell me what to do to get this sorted? :)

  • Avatar
    Jo Saunders

    Okay I've found the fix! (for anyone who needs to know) - I needed to replace 

    {{link ‘new_request’ class=‘submit_a_request’}}

    with

    {{#if signed_in}}
    {{link ‘new_request’}}
    {{/if}}

     

  • Avatar
    Trapta

    Hi @Jo Saunders,

    You don't have to replace anything instead, you have to add one code either the Zendesk component which is 

    {{#if signed_in}}
     {{link 'new_request' class='submit-a-request' role='button'}}
    {{/if}}

    either the JS code which is

    // Show div html based on role
    if (HelpCenter.user.role=="anonymous"){
    $('a.submit-a-request').hide();

    In both the cases, remove the other one and it will work for you.

    Thanks

  • Avatar
    Jo Saunders

    Hi @Trapta

    I put both those codes in place but not at the same time, neither worked for me. I put this in place:

    {{#if signed_in}}
    {{link ‘new_request’}}
    {{/if}}

    and it now works - but thanks!

  • Avatar
    Jessie - Community Manager

    Glad you got it working, Jo!

Please sign in to leave a comment.

Powered by Zendesk