How to Restrict WordPress User Roles for Specific Form and Pages
The purpose of WordPress user roles is to let the site owner have control over what the users can or cannot do in the site. Based on the user roles you can now restrict user access on your forms thus enhancing your security measures.
“User Roles” play a huge part in any WordPress environment. Essentially, there are five default user roles in WordPress, with each having their own specific set of permissions. The administrator has the maximum authority among all the roles. In order to decide which user role can access which form, one must restrict WordPress forms by user roles. Eventually, this will give a boost to your WordPress form security as well.
RegistrationMagic is one such plugin that allows a user to access forms depending on their roles. In this tutorial, we will discuss how you can restrict WordPress forms by user roles in online forms.
Read More.
How to restrict WordPress registrations by age and other parameters
Navigate to “Access Control” on your WordPress form
Install the RegistrationMagic plugin from your dashboard. Then, click on the “All Forms” link from the RegistrationMagic menu to land on the All Forms page.
Here you will find all the forms that you create with this plugin. Hover your cursor on the form that you want to edit and click on the “Dashboard” link.
You are now on the Dashboard of the form. From here, you can configure, publish, and analyze forms. From here, you can also take care of your WordPress form design. To move forward, scroll down to the “Configure” section. Then, click the “Access Control” icon to enable access control based on user role.
Enable WordPress User Roles Based Access Control for your Form
In this article, we will restrict form access based on WordPress user roles. So, scroll down to the “Enable user role based form access control” field. Check the checkbox to enable/restrict access to forms based on the current user role.
Select the user roles who can access the form. You can also select multiple user roles using the checkboxes. Users exclusively with the selected user roles can access the form content. In this case, we select the “Administrator” role. This means that going forward no one other than the admins can access the form.
So, now let us try to access this form from the frontend.
You can see, we are getting a login form for the user to login. Since the form is locked for a user role, it is mandatory for the user to login so the form can check the role. Let us now login as a subscriber and see the results.
Now you can see the message that we are, as a subscriber, not allowed to access the form. This is because we made this form only accessible to the admin.
List of Default WordPress User Roles
Just for a quick overview, here is the list of default user roles available in WordPress:
Administrator – Users can access the dashboard, modify core files and themes using this role. An admin can also edit other user roles besides enjoying complete control over the content.
Editor – This role grants access to a part of the content. Editors cannot access themes, widgets, and plugins. The editor role can publish or edit any page or post.
Author – An author can only tweak elements of his/her own post. To sum up, they don’t have permission to access the content of other users.
Contributor – After a contributor writes or modifies a post, he/she must seek permission from the admin to publish it. Contributors cannot access media files without the say of the admin or editor.
Subscriber – After WordPress new user registration, every user is offered a Subscriber role if not specifically set to any other role. Subscribers can only view your site and comment under your posts. However, they have their own limits. As a subscriber, you cannot alter settings or the content of the site.
With RegistrationMagic, you can create separate forms for separate purposes and users. And in just a few clicks, you are good to go. Hence, managing forms is no more a big deal with the use of RegistrationMagic. To know more about this plugin, visit our Facebook page.
- Complete Automation Guide for WordPress Forms - July 20, 2024
- WordPress User Management Plugin Guide - July 18, 2024
- Add CAPTCHA in WordPress Login and Registration Form? - July 16, 2024
- How to Send Automated Welcome Emails in WordPress - July 15, 2024
- WordPress User Roles, Permissions & Role Editor [Complete Guide] - July 14, 2024
- How to Display Custom Success Message in WordPress Forms - July 12, 2024
- Publish Registration Forms and Display Registered Users - July 11, 2024
- How to Approve WordPress User Accounts Without Logging Into Dashboard - January 25, 2021
- How to Set up Two Factor Authentication in WordPress - April 4, 2019
- How to Edit or Replace Default WordPress Registration Form - April 2, 2019