Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions features/user.feature
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ Feature: Manage WordPress users
3
"""

When I try `wp user update 9999 --user_pass=securepassword`
Then the return code should be 1
And STDERR should contain:
"""
Error: No valid users found.
"""

Scenario: Delete user with invalid reassign
Given a WP install
And a session_no file:
Expand Down
4 changes: 4 additions & 0 deletions src/User_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,10 @@ public function update( $args, $assoc_args ) {
$user_ids[] = $user->ID;
}

if ( empty( $user_ids ) ) {
WP_CLI::error( 'No valid users found.' );
}

$skip_email = Utils\get_flag_value( $assoc_args, 'skip-email' );
if ( $skip_email ) {
add_filter( 'send_email_change_email', '__return_false' );
Expand Down