Using the Access plugin, you can control who can see and edit different fields. This way, you can create fields that some users can modify and other users can only see, or not see at all.
Here are some examples of why you need access control for user fields:
- A membership site – the site admin can change user membership levels, each user can see his membership and others cannot.
- A listing site – users need to pay to change listing settings, site admins can edit anything.
With Access integration, you can assign privileges to all users of a certain type or to specific users.
1. Set Access control for field groups
First, you need to create some Types field groups. With Access, you can control both post custom fields (post meta) and user custom fields (user meta). Once you have fields groups and Access plugin installed, go to Toolset -> Access Control and open the Types Fields tab.
You will see a list of everything under Access control, combining post fields and user fields groups
Click on the field group for which you want to set access control. Note that post fields and user fields have different sets of permissions.
|Post field group||User field group|
You can set selective access by checking the different options. You can grant specific privileges to specific users by clicking on the user icon.
Please remember that WordPress allows only administrators to access the profiles of other users. Administrators are allowed to do anything in the site, so Access does not include an option to allow users to access other users’ fields.
Access settings are for entire groups of fields. If you want to assign different access privileges to different fields, create separate groups for them and set the privileges to these groups.
2. Edit and Read-Only Field Modes
When you grant view privileges but not modify privilege, fields will display as read-only.
In that case, the field group displays all fields as readonly inputs.
You can style the appearance of fields in both edit and read-only mode.