admin管理员组文章数量:1418050
I wonder if it is possible to create a new user role and give him special limited abilities?
I'd like to have some users who can only add events onto the calendar. They should only be able to work within events calendar taxonomy and edit add their posts but not publish them something like contributor but more limited!
I wonder if it is possible to create a new user role and give him special limited abilities?
I'd like to have some users who can only add events onto the calendar. They should only be able to work within events calendar taxonomy and edit add their posts but not publish them something like contributor but more limited!
Share Improve this question edited Feb 10, 2015 at 14:17 Brad Dalton 6,9852 gold badges36 silver badges47 bronze badges asked Nov 7, 2012 at 16:24 user8842user8842 1- Without programming knowledge you can add user roles and capabilities in WordPress by different free plugins, here is one of them User Roles and Capabilities – Mahabubur Rahman Commented Feb 10, 2015 at 11:13
4 Answers
Reset to default 9Yes. WordPress has robust built-in Roles and Capabilities system desgined to do exactly what you are looking for.
To add a new role, use the add_role()
function in your theme's functions.php
or a plug-in like so:
$role = add_role( 'event_manager', 'Event Manager', array(
'read' => true, // True allows that capability
) );
if ( null !== $role ) {
echo 'Yay! New role created!';
} else {
echo 'Oh... the event_manager role already exists.';
}
To add a new capability, use the add_cap()
function like this:
$role = get_role( 'event_manager' );
$role->add_cap( 'manage_events' );
Yes, definitely possible with a plugin like Members. You can create new roles and capabilities, but remember - you'll actually need inject these custom capabilities into your plugin. What you may want to do is just install the plugin and then modify the existing contributor role to suite your needs.
For really granular control, you could bundle that with the Role Scoper plugin as well. Thanks!
Add the below code in functions.php file
add_role(
'custom_editor',
__( 'Custom Editor' ),
array(
'read' => true, // true allows this capability
'edit_posts' => true,
)
);
Replace Custom Editor with your role name
Besides pure code solutions, I would also suggest this free plugin I used since several years ago, and still. It's really stable and reliable, and actively updated.
https://wordpress/plugins/user-role-editor/
本文标签: Is it possible to add new user Roles
版权声明:本文标题:Is it possible to add new user Roles? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745259376a2650285.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论