Skip to content

Commit 246e6c6

Browse files
Feedback Updates
1 parent 2e39881 commit 246e6c6

File tree

2 files changed

+18
-46
lines changed

2 files changed

+18
-46
lines changed

features/user.feature

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,24 @@ Feature: Manage WordPress users
376376
administrator
377377
"""
378378
379+
And a user exists with login 9999
380+
381+
When I run `wp user update 9999 --user-pass=admin`
382+
Then STDERR should contain:
383+
"""
384+
Error: Parameter errors:
385+
unknown --user-pass parameter
386+
Did you mean '--user_pass'?
387+
"""
388+
389+
And a user exists with login 9999
390+
391+
When I run `wp user update 9999 --user_pass=admin`
392+
Then STDOUT should contain:
393+
"""
394+
Success: Updated user 9999.
395+
"""
396+
379397
Scenario: Managing user capabilities
380398
Given a WP install
381399

src/User_Command.php

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -518,9 +518,6 @@ public function create( $args, $assoc_args ) {
518518
* [--role=<role>]
519519
* : A string used to set the user's role.
520520
*
521-
* --<field>=<value>
522-
* : One or more fields to update. For accepted fields, see wp_update_user().
523-
*
524521
* [--skip-email]
525522
* : Don't send an email notification to the user.
526523
*
@@ -536,49 +533,6 @@ public function update( $args, $assoc_args ) {
536533
unset( $assoc_args['user_login'] );
537534
}
538535

539-
// Define valid fields for wp_update_user().
540-
$valid_fields = array(
541-
'user_pass',
542-
'user_nicename',
543-
'user_url',
544-
'user_email',
545-
'display_name',
546-
'nickname',
547-
'first_name',
548-
'last_name',
549-
'description',
550-
'rich_editing',
551-
'user_registered',
552-
'role',
553-
'syntax_highlighting',
554-
'comment_shortcuts',
555-
'admin_color',
556-
'use_ssl',
557-
'show_admin_bar_front',
558-
'locale',
559-
);
560-
561-
// Check for invalid field names.
562-
$invalid_fields = array();
563-
foreach ( array_keys( $assoc_args ) as $field ) {
564-
// Skip special flags like 'skip-email'.
565-
if ( 'skip-email' === $field ) {
566-
continue;
567-
}
568-
569-
if ( ! in_array( $field, $valid_fields, true ) ) {
570-
$invalid_fields[] = $field;
571-
}
572-
}
573-
574-
// Warn about invalid fields.
575-
if ( ! empty( $invalid_fields ) ) {
576-
foreach ( $invalid_fields as $field ) {
577-
WP_CLI::warning( "Unknown --{$field} parameter." );
578-
unset( $assoc_args[ $field ] );
579-
}
580-
}
581-
582536
if ( isset( $assoc_args['role'] ) ) {
583537
self::validate_role( $assoc_args['role'], true );
584538
}

0 commit comments

Comments
 (0)