Hiding the "Submit a Request button" until signed in

12 Comments

  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member of The Year - 2021

    Hi,

    You can try this type:

    1). Copy the below code because it's your mentioned code for submit reauest button.

    {{#if signed_in}} 
    <a href="/hc/requests/new" class="btn btn--md btn--primary is-hidden--md-down header__request-right hide_button">
    {{t 'submit_a_request'}}
    </a>
    {{else}}
    <a href="/hc/requests/new" class="btn btn--md btn--primary is-hidden--md-down header__request-right">
    {{t 'submit_a_request'}}
    </a>
    {{/if}}

    Screenshot for the same:

     

     

    2). Add the CSS at the bottom of your stylesheet.

    .header__request-right.hide_button{display:none;}

     

    Thank You

    Team

    0
  • Dave Smith

    Hi Ifra,

    Thank you for responding to this.
    Just for my own sanity, would the code above not hide the button for signed in and non-signed in persons?

    Dave

    0
  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member of The Year - 2021

    Hi Dave, the above code is for, when a user signed in, the submit button would be hidden and when a user signed out, the submit button would be shown.

     

    Another way is, you can hide the submit button to the signed-in users by this code.

    1. Hide this button until you were signed in,

    {{#unless signed_in}}
    <a href="/hc/requests/new" class="btn btn--md btn--primary is-hidden--md-down header__request-right">
    {{t 'submit_a_request'}}
    </a>
    {/unless}}

     

     

     

    2. Make the user have to sign in when clicking this button.

    It's possible, but I'm not sure if that's the right way to do this.

     

     

    Team

    0
  • Dave Smith

    Hi Ifra,

    Thanks for getting back to me.
    Can we get that the other way around? So I want the submit button to show when they are signed in, and not show when they are not signed in.

    Dave

    0
  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member of The Year - 2021

    So you can use this code:

    To show submit button when users signed-in.

    {{#if signed_in}} 
    <a href="/hc/requests/new" class="btn btn--md btn--primary is-hidden--md-down header__request-right">
    {{t 'submit_a_request'}}
    </a>
    {/if}}

     

    If any confusion let me know :)

     

    Thanks

     

     

    0
  • Dave Smith

    Hi Ifra,

    Would I also need the CSS code in as well as that header code?

    So in other words:

    Header:

    {{#if signed_in}} 
    <a href="/hc/requests/new" class="btn btn--md btn--primary is-hidden--md-down header__request-right">
    {{t 'submit_a_request'}}
    </a>
    {/if}}

    CSS:

    .header__request-right.hide_button{display:none;}

    Dave

    0
  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member of The Year - 2021

    No, 

    Add only this code:

    {{#if signed_in}} 
    <a href="/hc/requests/new" class="btn btn--md btn--primary is-hidden--md-down header__request-right">
    {{t 'submit_a_request'}}
    </a>
    {/if}}

     

    CSS not added in this case.

     

    0
  • Dave Smith

    Thank you.

    I added that wrapper around the button, as laid out above, but when a user signs in, the submit a request button doesn't show.

    User not signed in: shows sign in button, no "submit request" button
    User signed in: no "submit request" button shows

    Am I missing something here?

    0
  • Dave Smith

    Hi Ifra,

    Think I've got it sorted now. I think it was being thrown off by the 

    is-hidden--md-down header__request-right

    part, so I simply removed it. Now it works as intended. Thank you for all of your help.

    Dave.

     

    0
  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member of The Year - 2021

    Glad to hear, cheers!

    0
  • Anita Rajkumar

    Hi Ifra,

    When the user click the 'Submit a request' before Sign-in, how to show  'Please sign-in to Submit a request'  in the ...zendesk.com/hc/en-us/requests/new  page?

    only signin users can submit the request.

     

    0
  • Ifra Saqlain
    Community Moderator
    Most Engaged Community Member of The Year - 2021

    Hi Anita, 

    You need to update the setting for it.

    1). Click the Zendesk Products icon.

     

    click on -

     

    2). Then click on Admin Center, blue color font.

    3).In Admin Center, click the People icon () in the sidebar, then select Configuration > End users.

    4). Uncheck the Anybody can submit tickets.

    5) . This option is not visible if you haven't activated your Help Center yet.

    7). Click Save Tab.

     

    If any query let me know :)

    Thanks

    0

Please sign in to leave a comment.

Powered by Zendesk