Home › Toolset Professional Support › [Resolved] Post Form restricted message
Problem:
The user has a form managed by Access that is not active for guest users. He would like to display a message for them.
Solution:
Use a conditional block that will display the message for guest users only. Check this screenshot http://prntscr.com/ue9lg4
Activate debug mode if you need to debug the conditions.
http://prntscr.com/ue9m4f
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | - | - | 9:00 – 13:00 |
14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | - | - | 14:00 – 18:00 |
Supporter timezone: Africa/Casablanca (GMT+01:00)
Tagged: Content-submission forms, Toolset Forms
Related documentation:
This topic contains 10 replies, has 2 voices.
Last updated by jillT 4 years, 2 months ago.
Assisted by: Jamal.
I have a post form and need it to display a message if the user is not logged in, or not allowed to view the form.
At the moment, if you're restricted it merely shows the title
Hello and thank you for contacting the Toolset support.
Depending on whether you build your page with the Block editor or the legacy one, you can add a conditional block or shortcode to check if the user is logged in and then display a message or the form.
Check this previous ticket for shortcode based conditions https://toolset.com/forums/topic/conditional-output-not-producing-expected-results/
https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/using-shortcodes-in-conditions/
With the same logic, you can put a condition on the conditional block if you are using blocks.
Thank you. I am trying (!!) to use blocks and have to say I am really struggling.
In creating/editing a post form there are no blocks in the usual sense as a post. The only thing I could see was to put an HTML content in the form and include the code snippet. I did this with the following snippet, but it doesn't show up if I'm not logged in.
[wpv-conditional if="( '[wpv-current-user info='logged_in']' eq 'false' )"]In order to suggest a directory listing you must be logged in.[/wpv-conditional]
If your website is online, please allow me temporary access to it and let me check this closer. Please, let me know, what form and where are you trying to display it.
If it is not online, I'll prepare a test site on our platform and we'll work on it to help you get what you want.
Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **
Thank you for the credentials.
The form is restricted with Toolset Access rules and will not display for guest users.
But the page title will always be visible, because pages are public, and guest users can view them.
If you want to display a message for guest users, you can use a conditional block on the user status. I implemented a test on the page. Check this screenshot hidden link
But if you want to hide the page title too. I'll suggest that you create an Access group and add the page to it. That way you can configure what to display when the user is not logged in. Check the second section of this article https://toolset.com/course-lesson/restricting-access-to-pages/
I hope this helps. Let me know if you have any questions.
Thank you and I apologise if my original post was not clear enough.
What you have done is exactly what I wished to do.
Could you please tell me how you did the 'test' to display the message, as I am unable to see how it was done
I understood, that you want to display a message, instead of the form for non-logged-in users, right! So I tested with an incognito window.
You can also test it, by logging out from the site and visit that page or using a different browser, where you are not logged in.
Perhaps I should start again, as you do not seem to understand what I am saying, I shall try harder to explain.
- Yes, the form is restricted to members, ie those logged in.
- Yes, I want a specific message to show if the user is not logged in and thus restricted.
- BEFORE I wrote my post here, when not logged in I would only see the title. I want a specific message to tell them to log in or register.
- After your reply I added a condition, but this was obviously incorrect and still only the title showed.
- after your reply where you said you implemented a test I looked and yes there is now a message there when not logged in. But it is not the wording I want. So I'm asking what you did to get that message to show so that I can change it.
Basically I want the following wording:
Sorry, you must be logged in in order to suggest a listing. Please either login or register (login & register to be links)
I hope that it is a bit clearer for you
Thank you, I understand. And my apologies for not providing enough details.
I implemented a conditional block on the page where the form is displayed. The conditional block allows us to set a condition and to put other blocks inside of it. When the condition is met, the wrapped blocks are displayed.
Go to to the page edit screen here hidden link
Check the conditional block and the paragraph block inside of it. Check this screenshot hidden link and this one hidden link
You can use the navigation button to select the condition block. Check this screenshot hidden link
I hope this answers your question. Let me know if you have any other questions.
Perfect!!! thank you so much!
My issue is resolved now. Thank you!