Allow only signed-in users to submit a ticket

8 Comments

  • Annastashia Cambridge
    Comment actions Permalink

    Hi Diziana, this is really useful thank you! It works that when the anon user selects the submit a request link it brings up the sign in/sign up screen. How can I apply the same logic to the mobile layout? 

    How can I apply the same logic to the mobile layout? The submit a request brings up the submit a request form which I don't want. 

    Many thanks, 

    Annastashia

    0
  • Diziana
    Comment actions Permalink

    Hi Annastashia,

    Thanks for reaching out to us. I think this should work. Did you disable the mobile layout from the HC settings? 

    I looked at your HC and it seems you haven't disabled the mobile layout option, please disable it.

    Also on responsive you need to add the submit button on the menu (hamburger icon) as for now only sign in seems to be listing.

    Please share if you have further any questions.

    Looking forward hearing from you.

    Cheers,

    Diziana

    0
  • Jake Bantz
    Comment actions Permalink

    Thanks for the tip Diziana.

    I did want to advertise that we now have some built in functionality to allow you to check if a user has signed in. Here's the sample code:

    {{#if signed_in}}
    {{link 'new_request'}}
    {{/if}}

    You can read more about the 'signed_in' helper here. This removes the need for Javascript, and instead the user will get the page without the submit a request link right away if they are not authenticated.

    Hope this is helpful!

    2
  • Jennifer Rowe
    Comment actions Permalink

    Oh, that's good to know. Thanks, Jake.

    0
  • Robert Swail
    Comment actions Permalink

    Zendesk - that's a good workaround for hiding the links from end-users, but that does not prevent them from using:

    https://{{base_url}}/hc/en-us/requests/new

    to get around it. 

    Is there a config setting or strategy that would not allow users to log a request unless logged in?

    Cheers,

    Bob

    Update - I used in the new_request_page.hbs so that seems to prevent anyone from invoking the https://{{base_url}}/hc/en-us/requests/new on the URL.

    {{#if signed_in}}
    ...
    {{/if}}
    0
  • Jake Bantz
    Comment actions Permalink

    You hit the nail on the head Robert! Wrapping the signed in condition around the ticket form will hide it for anonymous users as well. You could even include a message as an alternative (using an 'else' condition) like this:

    {{#if signed_in}}
    <h1>
    {{t 'submit_a_request'}}
    {{#if follow_up}}
    <span class="follow-up-hint">
    {{follow_up}}
    </span>
    {{/if}}
    </h1>
    <div class="form">
    {{request_form}}
    </div>
    {{else}}
    <h3>Please sign in to submit a ticket.</h3>
    {{/if}}

    This is from the default Copenhagen theme, so yours might look a little different, but I hope this helps.

    0
  • Teck Leong Fong
    Comment actions Permalink

    Hi Jake, what if i want to hide the submit request even for sign-in user, but embed the ticket form link at the article (which will prompt for user to sign in with above use of signed_in condition)

    0
  • Jake Bantz
    Comment actions Permalink

    Hello!

    First, I would recommend removing the request placeholder from the Header template since you don't want it to appear for any users.

    Next, know that our default Copenhagen theme has a request callout in its article_page.hbs template that looks like this:

    Here's the associated code:

    <div class="article-more-questions">
    {{request_callout}}
    </div>

    You could recycle my tip above, but instead wrap that around the request_callout:

    {{#if signed_in}}
    {{request_callout}}
    {{else}}
    Please sign in to submit a request.
    {{/if}}

    Hope that helps!

    0

Please sign in to leave a comment.

Powered by Zendesk