From fafabad6c6dd4e220dc3326f3615066dfb5ddde4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Mar 2026 22:17:48 +0000 Subject: [PATCH 1/4] Initial plan From 2a6f897cf6b345ba24b4aed87f0150ec6d9c87c2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Mar 2026 22:20:29 +0000 Subject: [PATCH 2/4] Fix: strip HTML tags from multisite user signup validation errors Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- features/user.feature | 17 +++++++++++++++++ src/User_Command.php | 5 +++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/features/user.feature b/features/user.feature index cd22acdd6..90a074e6b 100644 --- a/features/user.feature +++ b/features/user.feature @@ -267,6 +267,23 @@ Feature: Manage WordPress users Bob Jones """ + Scenario: Creating a user with an existing email in multisite shows a clean error message + Given a WP multisite install + + When I run `wp user create bobjones bobjones@example.com` + Then STDOUT should not be empty + + When I try `wp user create bobjones2 bobjones@example.com` + Then STDERR should contain: + """ + This email address is already registered. + """ + And STDERR should not contain: + """ + < + """ + And the return code should be 1 + Scenario: Managing user roles Given a WP install diff --git a/src/User_Command.php b/src/User_Command.php index e0c8654be..86929902a 100644 --- a/src/User_Command.php +++ b/src/User_Command.php @@ -460,7 +460,8 @@ public function create( $args, $assoc_args ) { if ( is_multisite() ) { $result = wpmu_validate_user_signup( $user->user_login, $user->user_email ); if ( ! empty( $result['errors']->errors ) ) { - WP_CLI::error( $result['errors'] ); + $error_message = implode( ' ', array_map( 'wp_strip_all_tags', $result['errors']->get_error_messages() ) ); + WP_CLI::error( $error_message ); } $user_id = wpmu_create_user( $user->user_login, $user->user_pass, $user->user_email ); if ( ! $user_id ) { @@ -1228,7 +1229,7 @@ public function import_csv( $args, $assoc_args ) { if ( is_multisite() ) { $result = wpmu_validate_user_signup( $new_user['user_login'], $new_user['user_email'] ); if ( ! empty( $result['errors']->errors ) ) { - WP_CLI::warning( $result['errors'] ); + WP_CLI::warning( implode( ' ', array_map( 'wp_strip_all_tags', $result['errors']->get_error_messages() ) ) ); continue; } $user_id = wpmu_create_user( $new_user['user_login'], $new_user['user_pass'], $new_user['user_email'] ); From b5e56b512b1d22900c93a015afc5b8a4cec27961 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Mon, 16 Mar 2026 10:57:43 +0100 Subject: [PATCH 3/4] Fix test --- features/user.feature | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/features/user.feature b/features/user.feature index 90a074e6b..2ab502d25 100644 --- a/features/user.feature +++ b/features/user.feature @@ -267,6 +267,26 @@ Feature: Manage WordPress users Bob Jones """ + # The error message changed in WP 5.9. + @less-than-wp-5.9 + Scenario: Creating a user with an existing email in multisite shows a clean error message + Given a WP multisite install + + When I run `wp user create bobjones bobjones@example.com` + Then STDOUT should not be empty + + When I try `wp user create bobjones2 bobjones@example.com` + Then STDERR should contain: + """ + Sorry, that email address is already used! + """ + And STDERR should not contain: + """ + < + """ + And the return code should be 1 + + @require-wp-5.9 Scenario: Creating a user with an existing email in multisite shows a clean error message Given a WP multisite install From 08d3262013f0b75c63a898af9752c1cf4bf46448 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Mon, 16 Mar 2026 11:35:16 +0100 Subject: [PATCH 4/4] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- features/user.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/user.feature b/features/user.feature index 2ab502d25..76ede2740 100644 --- a/features/user.feature +++ b/features/user.feature @@ -286,7 +286,7 @@ Feature: Manage WordPress users """ And the return code should be 1 - @require-wp-5.9 + @require-wp-5.9 Scenario: Creating a user with an existing email in multisite shows a clean error message Given a WP multisite install