Skip to content

Commit cdaca28

Browse files
authored
Fix warning message in user spam command (#481)
1 parent 6f7fa72 commit cdaca28

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

features/user.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,6 @@ Feature: Manage WordPress users
586586
And STDERR should be:
587587
"""
588588
Warning: Invalid user ID, email or login: '9999'
589-
Warning: User 9999 doesn't exist.
590589
Error: Only spammed 1 of 2 users.
591590
"""
592591
And the return code should be 1

src/User_Command.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,15 +1339,8 @@ private function update_msuser_status( $user_ids, $pref, $value ) {
13391339
$errors = count( $user_ids ) - count( $users );
13401340
}
13411341

1342-
foreach ( $user_ids as $user_id ) {
1343-
1344-
$user = get_userdata( $user_id );
1345-
1346-
// If no user found, then show warning.
1347-
if ( empty( $user ) ) {
1348-
WP_CLI::warning( "User {$user_id} doesn't exist." );
1349-
continue;
1350-
}
1342+
foreach ( $users as $user ) {
1343+
$user_id = $user->ID;
13511344

13521345
// Super admin should not be marked as spam.
13531346
if ( is_super_admin( $user->ID ) ) {

0 commit comments

Comments
 (0)