Hiding the "Submit a Request button" until signed in
Posted Aug 10, 2021
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.
1
23 comments
Tarandeep Gohlar
We're using the Copenhagen v1.0.0 theme.
We want to hide the submit a request option from end users and only make available for signed in users who are staff in Zendesk (admins, contributers, light agents).
How can we achieve this?
0
Brett Bowser
Thanks for sharing this 4954595227034! This is super helpful :)
0
Martha Chastain
My company recently hid the "Submit a request" button behind a login wall by using this code between lines 17-26 in the header section:



0
Ifra Saqlain
@HK,
Go to your header file and find "{{link 'new_request' class='submit-a-request'}}", then wrap it with the given condition " {{#if signed_in}} ... {{/if}}", you will have te final code snippet:
Thanks
0
HK
1263169183150
Hi there!
Is there an updated way to hide the Submit a Request button from anonymous users? We want it only to be shown to signed-in users.
Thank you!!
0
Ifra Saqlain
No problem @Emmanuel Gomes, check your console in your inspect tool or you can share URL of your HC here then I can figure out the issue.
0
Emmanuel Gomes
Hi 1263169183150 ,
I inserted this code at the bottom of the script.js file and the Submit button is still present for anonymous users. I want to temporarily disable the form-based ticket submission feature. Perhaps you could suggest another way to proceed.
Thank you.
0
Ifra Saqlain
Try this and let me know: add this code to the script.js file at the bottom.
0
Brittany Mandel
1263169183150- If you use the code that's been shared above on the newest version of the Copenhagen theme - it does not work as intended. When I inspect as an anonymous user - the request button is still there, as an end user a second request button appears to the left. Please update the code for the newest theme updates.
0
Ifra Saqlain
Hi @Brittany Mandel,
Share your query..
0
Sign in to leave a comment.