Improve wp user remove-role docs and output when no role argument is given#580
Improve wp user remove-role docs and output when no role argument is given#580
wp user remove-role docs and output when no role argument is given#580Conversation
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
wp user remove-role docs and output when no role argument is given
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Clarifies wp user remove-role <id> behavior when no role is provided by improving both the documentation and the success output message.
Changes:
- Documented the “no role args” behavior for
wp user remove-role. - Added an example for invoking the command without specifying roles.
- Updated the success message to explicitly state that roles were removed (not the user account).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/User_Command.php | Updates command docs and refines the success message for the no-role-argument path. |
| features/user.feature | Updates the acceptance test to assert the new success output text. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| WP_CLI::success( "Removed {$user->user_login} ({$user->ID}) from " . site_url() . '.' ); | ||
| WP_CLI::success( "Removed all roles from {$user->user_login} ({$user->ID}) on " . site_url() . '.' ); |
There was a problem hiding this comment.
The new message is clearer for single-site, but it may be inaccurate on multisite where the no-role path can remove the user from the site/blog (not just strip roles). Consider branching the message for multisite (e.g., explicitly “Removed user from site …” or “Removed all roles (user removed from site on multisite) …”) so the output reflects what actually happened.
| * removed from the user. | ||
| * |
There was a problem hiding this comment.
This doc update still omits the multisite nuance called out in the issue context (no role args may remove the user from the site/blog). Please update the synopsis description to mention the multisite behavior explicitly, so users aren’t surprised by being removed from a site when running the command on multisite.
| * removed from the user. | |
| * | |
| * removed from the user; on multisite, this removes the user from the current | |
| * site/blog. |
When
wp user remove-role <id>is called without a role argument, it silently removes all roles from the user (or removes the user from the blog on multisite). The behavior was undocumented and the success message—Removed {user} ({id}) from {site_url}.—sounded like the user account was deleted.Changes
"Removed {user} ({id}) from {site_url}."→"Removed all roles from {user} ({id}) on {site_url}."— clearly signals role removal, not account deletion, while retaining the site URL context[<role>...]and adds a corresponding exampleOriginal prompt
wp user remove-role <id>with no role arguments could produce a less scary display result #291🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.