Hide or lock out user from your forms
How to hide, password protect or lock out user from submitting a WordPress form.
If you are looking for a way to prevent duplicate entries read this article instead. If you want to lock a form after specific amount of submissions read this article. And if you are looking for a way to password protect a form read this article. And in case you want to just hide the form after it was successfully submitted by the user read this article.
In this article we will explain what different option you have in regards to hiding, locking and password protecting your WordPress form. With these options you can hide a form, password protect or lock forms for specific users, so that they won't be able to submit the form.
For instance you can hide the form from logged out users or from specific user roles. You can also display a "lockout" message based on these conditions to the user.
If you only want currently logged in users to be able to submit a form, you can enable the Allow only logged in users setting. Optionally you can choose to Hide the form from not logged in users (those that are logged out). Another options you have is to display a message to those that are logged out. And in case you are not hiding the form from the logged out users, you may also display a message after they tried to submit the form, as shown below.
Allow only logged in users to submit the form.
In some cases you might want to hide your form from already logged in users. For instance when you have a Registration form, you don't really require a logged in user to see this form, simply because they are already registered. You can do so by enabling the Hide form from logged in users settings as shown below.
Hiding forms from currently logged in users.
To allow only specific user roles from being able to submit the form you can enable the Allow only specific user roles setting. Followed by the roles you wish to allow to submit the form. You can select multiple roles by holding the CTRL key on your keyboard while left clicking the roles as shown below.
Allow only specific user roles to submt the form.
In most cases when a user is locked out, you will probably want to hide the form from this user. You can do so by enabling the Hide form from locked out users setting, as shown below.
Hiding the form from a locked out user.
Whenever a user is locked out based on any of the conditions, you can optionally display a message to the user to inform them.
Display a message or notification regarding the lockout.