Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 8 additions & 0 deletions features/user.feature
Original file line number Diff line number Diff line change
Expand Up @@ -728,4 +728,12 @@ Feature: Manage WordPress users
"""
newtestuser
"""
Scenario: Updating an invalid user should return an error
Given a WP install
When I try `wp user update 9999 --user_pass=securepassword`
Comment thread
mrsdizzie marked this conversation as resolved.
Outdated
Then the return code should be 1
And STDERR should contain:
"""
Error: No valid users found.
"""

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