Skip to content

Commit

Permalink
Merge pull request #495 from ernilambar/274-user-nickname
Browse files Browse the repository at this point in the history
Support nickname creating user
  • Loading branch information
swissspidy authored Apr 26, 2024
2 parents b45e103 + 18976c9 commit 55f8309
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
21 changes: 21 additions & 0 deletions features/user.feature
Original file line number Diff line number Diff line change
Expand Up @@ -708,3 +708,24 @@ Feature: Manage WordPress users
Then STDOUT should be a table containing rows:
| Field | Value |
| user_url | http://www.testsite.com |
Scenario: Support nickname creating and updating user
Given a WP install
When I run `wp user create testuser [email protected] --nickname=customtestuser --porcelain`
Then STDOUT should be a number
And save STDOUT as {USER_ID}
When I run `wp user meta get {USER_ID} nickname`
Then STDOUT should be:
"""
customtestuser
"""
When I run `wp user update {USER_ID} --nickname=newtestuser`
And I run `wp user meta get {USER_ID} nickname`
Then STDOUT should be:
"""
newtestuser
"""
2 changes: 2 additions & 0 deletions src/User_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,8 @@ public function create( $args, $assoc_args ) {

$user->display_name = Utils\get_flag_value( $assoc_args, 'display_name', false );

$user->nickname = Utils\get_flag_value( $assoc_args, 'nickname', false );

$user->first_name = Utils\get_flag_value( $assoc_args, 'first_name', false );

$user->last_name = Utils\get_flag_value( $assoc_args, 'last_name', false );
Expand Down

0 comments on commit 55f8309

Please sign in to comment.