entity-command icon indicating copy to clipboard operation
entity-command copied to clipboard

`wp user create` ignores the `user_url` argument

Open kevin75001 opened this issue 3 years ago • 3 comments

Hi,

When using command line wp create user with --user_url argument, the value is ignored.

Step to reproduce :

/usr/bin/php /usr/local/bin/wp-cli --path='/path/to/wordpress/' user create 'testurl' '[email protected]' --role='editor' --user_pass='strong_password' --first_name='first' --last_name='last' --user_url='http://www.testsite.com' --debug

No error reported in debug.

Then :

/usr/local/bin/wp-cli --path='/path/to/wordpress/' user get testurl --fields=user_url

Return empty value instead of http://www.testsite.com

kevin75001 avatar Mar 22 '22 08:03 kevin75001

Hi @kevin75001,

in your example you set --site_url, not --user_url.

chesio avatar Mar 22 '22 15:03 chesio

Oh sorry, this is a wrong copy/past from test command.

Using --site_url produce error that option don't exist, so the problem is when using the correct --user_url, i edit my first post to give a correct way to reproduce

kevin75001 avatar Mar 22 '22 15:03 kevin75001

Thanks for the report, @kevin75001 !

I've confirmed the bug:

$ wp user create 'testurl' '[email protected]' --role='editor' --user_pass='strong_password' --first_name='first' --last_name='last' --user_url='http://www.testsite.com' --debug
Success: Created user 2.
$ wp user get testurl --fields=user_url
+----------+-------+
| Field    | Value |
+----------+-------+
| user_url |       |
+----------+-------+

It looks like each of the attributes are handled individually, and user_url is missing from the list:

https://github.com/wp-cli/entity-command/blob/66bdeae488a8f7c96e8200e62d54c159c1129062/src/User_Command.php#L403-L409

If you'd like, feel free to submit a pull request with tests to fix!

danielbachhuber avatar Aug 31 '22 15:08 danielbachhuber

I can tackle this one.

kjohnson avatar Sep 11 '22 17:09 kjohnson