Hiding the "Submit a Request button" until signed in
Hi everyone,
I've had a look through the forums and posts but can't find an answer to my scenario, so thought I'd ask it.
In our help center, we have the "Submit a Request" option as a button, rather than plain text in the header. Before changing themes, the previous setup had the "Submit a request" link hidden until the user signed in. However, our previous HC did not have the "submit" set as a button.
I've tried wrapping the button with the {{#if signed_in}} code, but it doesn't seem to make any difference.
My current code looks like this:
{{! Submit a request }}
<a href="/hc/requests/new" class="btn btn--md btn--primary is-hidden--md-down header__request-right">
{{t 'submit_a_request'}}
</a>
What would I need to do to either:
1. Hide this button until you were signed in, or
2. Make the user have to sign in when clicking this button
Many thanks for any help or advice you can offer here.
-
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
-
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
-
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. -
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
-
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
-
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
-
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.
-
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 showsAm I missing something here?
-
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.
-
Glad to hear, cheers!
-
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.
-
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
Please sign in to leave a comment.
12 Comments