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 enhance 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.
Navigate to “Access Control” on your WordPress form
Install the RegistrationMagic plugin menu on your dashboard. Then, click on the “All Forms” link to land on the All Forms Page.
Here you will find all the forms that you create with this plugin. In this example, we will use the Exam Form. Hover your cursor on the form cover and click on the “Dashboard” link.
You are now on the Dashboard of the form. From here, you can configure, publish, and analyze forms. In short, you can use this space for complete WordPress form design. To move forward, scroll down to the “Configure” section. Then, click the “Access Control” icon to enable access control based on date, passphrase or 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.
Only the users belonging to the selected roles from the underlying area can access the form. Select the user roles who can access the form. You can also select multiple user roles using the checkboxes below. 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 an “access denied” message when we are trying to fill this form. This is because we made this form only accessible to the admin, and I am logged in as an Author for this particular example.
User Role Based Account Creation
Now, we can configure a form to create a specific role with every user registration. This way, we can reduce the work of assigning roles to individual users.
First, select a form. Now, we will work with the Product form.
Proceed to the dashboard of the form. Then go to Accounts.
In the Accounts page of your form enable “Also create WP account“. Then in “WordPress user role” select any role of your choice. I selected Subscriber. Then Save the settings. Now whoever will fill this form will be automatically assigned the Subscriber role.
So, let’s check it out from the frontend. We will go to the User Area and find a user account who has submitted the form. Then we are going to see the role that the user has been assigned.
So, we see the user Ron submitted the Product Form. Automatically, he got the role of a subscriber since we configured the form so.
List of Default WordPress User Roles
Administrator Role – 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 Role – 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 Role – 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 Role – 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 Role – 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.
Use the checkbox to select which “WordPress User Roles” can access your form. This way you can easily restrict forms by WordPress user roles on your site. This way you can also create WordPress private pages by restricting users based on their roles.
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.
- WordPress Class Registration Plugin – Enrol Users, Collect Payments & More - November 28, 2018
- WordPress User Management Plugin Guide - November 27, 2018
- How to Allow WordPress Login and Registration using Email - October 5, 2018
- How to Display WordPress Member Directory - October 1, 2018
- How to Disable WordPress Admin Bar for all Users Except Admin - September 29, 2018
- How to Disable New User Notification Emails in WordPress - September 28, 2018
- How to Restrict WordPress User Access by Passphrase Code - September 26, 2018
- How to Restrict User Access by Date in WordPress - September 25, 2018
- How to Restrict WordPress Forms By User Roles - September 24, 2018
- How to Configure Registration Form in WordPress - September 12, 2018