我也看到过类似的问题,但是我发现问一个与此相近的问题却没有得到回答。
我正在尝试为我们的多站点安装支持团队创建一个角色,他们可以像超级管理员一样访问所有站点,还可以管理/创建/编辑/删除网络中的用户和站点。
根据Codes on capabilities 这个manage_sites
和manage_network_users
应该授予这些选项,还是我没有正确阅读?到目前为止,我的插件的代码如下:
function sqms_add_custom_roles() {
add_role(
\'sqms_support_team\',
__( \'Support Team\' ),
array(
\'delete_others_pages\' => true,
\'delete_others_posts\' => true,
\'delete_pages\' => true,
\'delete_posts\' => true,
\'delete_private_pages\' => true,
\'delete_private_posts\' => true,
\'delete_published_pages\' => true,
\'delete_published_posts\' => true,
\'edit_dashboard\' => true,
\'edit_files\' => true,
\'edit_others_pages\' => true,
\'edit_others_posts\' => true,
\'edit_pages\' => true,
\'edit_posts\' => true,
\'edit_private_pages\' => true,
\'edit_private_posts\' => true,
\'edit_published_pages\' => true,
\'edit_published_posts\' => true,
\'edit_theme_options\' => true,
\'export\' => true,
\'import\' => true,
\'list_users\' => true,
\'manage_categories\' => true,
\'manage_links\' => true,
\'manage_options\' => true,
\'moderate_comments\' => true,
\'promote_users\' => true,
\'publish_pages\' => true,
\'publish_posts\' => true,
\'read_private_pages\' => true,
\'read_private_posts\' => true,
\'read\' => true,
\'remove_users\' => true,
\'switch_themes\' => true,
\'upload_files\' => true,
\'edit_users\' => true,
\'create_users\' => true,
\'delete_users\' => true,
\'unfiltered_html\' => true,
\'manage_sites\' => true,
\'manage_network_users\' => true,
)
);
}
function sqms_remove_custom_roles() {
remove_role( \'sqms_support_team\' );
}
register_activation_hook( __FILE__, \'sqms_add_custom_roles\' );
register_deactivation_hook( __FILE__, \'sqms_remove_custom_roles\' );
“网络”选项不会显示在“我的站点”菜单中,并导航到/站点新建。php只给出一个无权限错误。
有什么建议吗?非常感谢。