WordPress的用户提供角色编辑用户

问题描述:

试图让用户角色编辑其他用户:WordPress的用户提供角色编辑用户

$edit_editor = get_role('designer'); 
$edit_editor->add_cap('edit_users'); 
$edit_editor->add_cap('list_users'); 
$edit_editor->add_cap('promote_users'); 
$edit_editor->add_cap('create_users'); 
$edit_editor->add_cap('add_users'); 
$edit_editor->add_cap('delete_users'); 

现在用户能够得到用户列表部分,但不能编辑现有用户。我怎样才能解决这个问题? enter image description here

您可以添加角色,所以:

$result = add_role(
     'editor_of_users', 
     __('Editor of Users'), 
     array(
      'edit_users' => true, 
      // Add more capabilities... 
     ) 
    ); 
    if (null !== $result) { 
     echo 'Yay! New role created!'; 
    } 
    else { 
     echo 'Oh... the editor_of_users role already exists.'; 
    } 

欲了解更多信息,您可以显示为红色约文档:add_role

而这里的所有用户的功能:Roles and Capabilities