WordPress defaults to "subscribers," "Contributors," "Author," "Edit," and "admin" five user roles, the permissions from low to high, but the default five roles may not be enough for us, then you can use the Add_role () function to create a role.
Usage
Add_role ($role, $display _name, $capabilities);
Parameters
$role
(string) (required) User role ID
Default value: None
$display _name
(string) (required) The name of the user role displayed in the foreground
Default value: None
$capabilities
(array) (optional) Permissions for user roles
Default value: None
return value
If the role of this role ID does not exist and the creation succeeds, the Wp_role class is returned, the user role already exists, or the creation failure returns NULL.
Example
$result = Add_role (' new_role_created ', __ (' New User Role example ', ' Bing '), Array (
' read ' => true,
' edit_posts ' => tru E,
' delete_posts ' => false
));
if ($result) echo ' user role was created successfully! ';
else echo ' because the user role already exists or otherwise causes the creation to fail! ';
Other
This function is located at: wp-includes/capabilities.php
WordPress user system seems to be very simple, but the scalability is very strong, good use of plug-ins, you can make the user system WordPress is not more than the professional forum system.
User's rights management is a very important part of the user system, although these several identity authority design is very scientific, but still can not meet everyone's needs, this article will teach you how to customize these several identity permissions.
First installs and enables the Capability Manager enhanced plug-in, enters "the user" → "capabilities" carries on the Authority management.
First select an identity to edit permissions on the right side of select New role, and then adjust the permissions on the left.
After the adjustment, you can save.