How do I make this (and the pages) appear for authors, now that they actually have the relevant capabilities?
They don’t have the needed capabilities, just because a role can add/edit/remove users does not mean they can list_users
.
Similarly there are other capabilities such as role promotion etc, here’s the code for administrators, e.g. this is what the code in WordPress core looks like:
$role = get_role( 'administrator' );
if ( ! empty( $role ) ) {
$role->add_cap( 'update_core' );
$role->add_cap( 'list_users' );
$role->add_cap( 'remove_users' );
$role->add_cap( 'promote_users' );
and if you look in wp-admin/menu.php
you’ll see where it adds the user menus:
if ( current_user_can( 'list_users' ) ) {
$menu[70] = array( __( 'Users' ), 'list_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'dashicons-admin-users' );
} else {
$menu[70] = array( __( 'Profile' ), 'read', 'profile.php', '', 'menu-top menu-icon-users', 'menu-users', 'dashicons-admin-users' );
}
if ( current_user_can( 'list_users' ) ) {
$_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php.
$submenu['users.php'][5] = array( __( 'All Users' ), 'list_users', 'users.php' );
if ( current_user_can( 'create_users' ) ) {
$submenu['users.php'][10] = array( __( 'Add New User' ), 'create_users', 'user-new.php' );
} elseif ( is_multisite() ) {
$submenu['users.php'][10] = array( __( 'Add New User' ), 'promote_users', 'user-new.php' );
}
$submenu['users.php'][15] = array( __( 'Profile' ), 'read', 'profile.php' );
} else {
$_wp_real_parent_file['users.php'] = 'profile.php';
Capabilities added by core have some oddness like this where you can add/edit/create/remove things but unless you can read/list/view them those capabilities are useless, and it doesn’t always make immediate sense due to backwards compatibility. Always double check and if in doubt add all capabilities that seem related and then whittle them down, or check the code for core.