Skip to content

Commit

Permalink
Fix warning message in user spam command (#481)
Browse files Browse the repository at this point in the history
  • Loading branch information
ernilambar authored Mar 1, 2024
1 parent 6f7fa72 commit cdaca28
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
1 change: 0 additions & 1 deletion features/user.feature
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,6 @@ Feature: Manage WordPress users
And STDERR should be:
"""
Warning: Invalid user ID, email or login: '9999'
Warning: User 9999 doesn't exist.
Error: Only spammed 1 of 2 users.
"""
And the return code should be 1
Expand Down
11 changes: 2 additions & 9 deletions src/User_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -1339,15 +1339,8 @@ private function update_msuser_status( $user_ids, $pref, $value ) {
$errors = count( $user_ids ) - count( $users );
}

foreach ( $user_ids as $user_id ) {

$user = get_userdata( $user_id );

// If no user found, then show warning.
if ( empty( $user ) ) {
WP_CLI::warning( "User {$user_id} doesn't exist." );
continue;
}
foreach ( $users as $user ) {
$user_id = $user->ID;

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

0 comments on commit cdaca28

Please sign in to comment.