From da791d8248a93f37c68f6234f1452b038db32699 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 26 Feb 2026 09:18:56 +0000 Subject: [PATCH 1/3] Initial plan From d0bd37cbb06de099858b633c89ad87d4a679659f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 26 Feb 2026 09:21:59 +0000 Subject: [PATCH 2/3] Improve wp user remove-role docs and output when no role argument given Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- features/user.feature | 5 ++++- src/User_Command.php | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/features/user.feature b/features/user.feature index 4f8640e14..0aeb73945 100644 --- a/features/user.feature +++ b/features/user.feature @@ -352,7 +352,10 @@ Feature: Manage WordPress users | roles | author | When I run `wp user remove-role 1` - Then STDOUT should not be empty + Then STDOUT should be: + """ + Success: Removed all roles from admin (1). + """ When I run `wp user get 1` Then STDOUT should be a table containing rows: diff --git a/src/User_Command.php b/src/User_Command.php index 7d7c68959..de20d3414 100644 --- a/src/User_Command.php +++ b/src/User_Command.php @@ -807,7 +807,8 @@ public function add_role( $args, $assoc_args ) { * : User ID, user email, or user login. * * [...] - * : Remove the specified role(s) from the user. + * : Remove the specified role(s) from the user. If not passed, all roles are + * removed from the user. * * ## EXAMPLES * @@ -817,6 +818,9 @@ public function add_role( $args, $assoc_args ) { * $ wp user remove-role 12 author editor * Success: Removed 'author', 'editor' roles for johndoe (12). * + * $ wp user remove-role 12 + * Success: Removed all roles from johndoe (12). + * * @subcommand remove-role */ public function remove_role( $args, $assoc_args ) { @@ -844,7 +848,7 @@ public function remove_role( $args, $assoc_args ) { $user->remove_all_caps(); } - WP_CLI::success( "Removed {$user->user_login} ({$user->ID}) from " . site_url() . '.' ); + WP_CLI::success( "Removed all roles from {$user->user_login} ({$user->ID})." ); } } From 32ef6e9acb94f857c112f82c226fb818c829b7d4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 26 Feb 2026 09:48:23 +0000 Subject: [PATCH 3/3] Include site URL in remove-role success message when no role given Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- features/user.feature | 4 ++-- src/User_Command.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/features/user.feature b/features/user.feature index 0aeb73945..cd22acdd6 100644 --- a/features/user.feature +++ b/features/user.feature @@ -352,9 +352,9 @@ Feature: Manage WordPress users | roles | author | When I run `wp user remove-role 1` - Then STDOUT should be: + Then STDOUT should contain: """ - Success: Removed all roles from admin (1). + Success: Removed all roles from admin (1) on """ When I run `wp user get 1` diff --git a/src/User_Command.php b/src/User_Command.php index de20d3414..29cd9ae51 100644 --- a/src/User_Command.php +++ b/src/User_Command.php @@ -819,7 +819,7 @@ public function add_role( $args, $assoc_args ) { * Success: Removed 'author', 'editor' roles for johndoe (12). * * $ wp user remove-role 12 - * Success: Removed all roles from johndoe (12). + * Success: Removed all roles from johndoe (12) on http://example.com. * * @subcommand remove-role */ @@ -848,7 +848,7 @@ public function remove_role( $args, $assoc_args ) { $user->remove_all_caps(); } - WP_CLI::success( "Removed all roles from {$user->user_login} ({$user->ID})." ); + WP_CLI::success( "Removed all roles from {$user->user_login} ({$user->ID}) on " . site_url() . '.' ); } }