Skip to content

Document that --network excludes roles from wp user list output#597

Merged
swissspidy merged 2 commits intomainfrom
copilot/fix-user-list-network-roles
Mar 16, 2026
Merged

Document that --network excludes roles from wp user list output#597
swissspidy merged 2 commits intomainfrom
copilot/fix-user-list-network-roles

Conversation

Copy link
Contributor

Copilot AI commented Mar 15, 2026

wp user list --network silently drops the roles field from results. This is intentional — in multisite, users can have different roles per site, making a single network-wide role value meaningless — but was completely undocumented.

Changes

  • Documentation: Expands the --network option description in User_Command::list_() to explain that roles is excluded and why.
  • Test: Adds a Behat scenario asserting that --network --format=csv output contains the expected header columns but not roles.
Original prompt

This section details on the original issue you should resolve

<issue_title>list user --network excludes role from results</issue_title>
<issue_description>
When running wp user list --network, the following fields are returned by default:

ID,user_login,display_name,user_email,user_registered

"roles", which listed in the documents as a default field is not being returned. It is returned when running wp user list but if multisite only users from the primary site are returned.

Please advise if there is an existing method to obtain all network users by role.</issue_description>

Comments on the Issue (you are @copilot in this section)

@danielbachhuber > Please advise if there is an existing method to obtain all network users by role.

There is not, because users can have different roles on different sites. We'll include some mention in the documentation to this effect.

To generate a list of all users with a given role, you'd need to list users for each site (see reference doc) and concatenate the list you've generated.</comment_new>
<comment_new>@danielbachhuber
@BhargavBhandari90 I think the example will need to be a bit more involved to conclusively document this:

To generate a list of all users with a given role, you'd need to list users for each site (see reference doc) and concatenate the list you've generated.</comment_new>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@github-actions github-actions bot added bug command:network-meta Related to 'network meta' command command:network-meta-list Related to 'network meta list' command command:network Related to 'network' command labels Mar 15, 2026
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix user list --network to include roles in results Document that --network excludes roles from wp user list output Mar 15, 2026
Copilot AI requested a review from swissspidy March 15, 2026 22:20
@codecov
Copy link

codecov bot commented Mar 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy marked this pull request as ready for review March 16, 2026 07:10
@swissspidy swissspidy requested a review from a team as a code owner March 16, 2026 07:10
Copilot AI review requested due to automatic review settings March 16, 2026 07:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR documents the existing behavior where wp user list --network excludes the roles field from output. In multisite, users can have different roles per site, making a single network-wide role meaningless. This was previously undocumented, causing confusion (#107).

Changes:

  • Expanded the --network option docstring in User_Command::list_() to explain that roles is excluded and why.
  • Added a Behat scenario verifying that --network --format=csv output omits the roles column.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/User_Command.php Updated --network option description to note roles exclusion and rationale.
features/user-list.feature Added test scenario asserting --network CSV output header lacks roles.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@swissspidy swissspidy merged commit 7064d7c into main Mar 16, 2026
73 checks passed
@swissspidy swissspidy deleted the copilot/fix-user-list-network-roles branch March 16, 2026 07:13
@swissspidy swissspidy added this to the 2.9.0 milestone Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug command:network Related to 'network' command command:network-meta Related to 'network meta' command command:network-meta-list Related to 'network meta list' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

list user --network excludes role from results

3 participants