Open lkraav opened 4 years ago
PS looking at user set-role
output, I'm not sure it fully makes sense either:
# wp user set-role 293 administrator
Success: Added leho (293) to <site> as administrator.
This reads like a user object was created, instead of a role change.
Your thoughts?
Hi, actually when there is no role listed, the user is being "deactivated" meanting they will no longer have access to the backend of the site, but their posts will still be visible at the website.
This is actually a good option to have in wp-cli on my opinion. Maybe the message can be edited only as it is a bit missleading.
From the code, it looks like the user is meant to be removed from the site if no role is specified:
When I tested, it seems like the role is removed as expected:
$ wp user remove-role danieltesting
Success: Removed danieltesting (2) from https://vanilla.test.
$ wp user list
+----+---------------+---------------+-----------------------------+---------------------+---------------+
| ID | user_login | display_name | user_email | user_registered | roles |
+----+---------------+---------------+-----------------------------+---------------------+---------------+
| 1 | daniel | daniel | daniel@handbuilt.co | 2023-05-17 12:02:14 | administrator |
| 2 | danieltesting | danieltesting | daniel+testing@bachhuber.co | 2023-07-13 16:16:05 | |
+----+---------------+---------------+-----------------------------+---------------------+---------------+
Maybe we could improve the documentation?
Bug Report
Describe the current, buggy behavior
wp user set-role
with no[role]
argument is documented as "adds the default role".But matching
remove-role
synopsis is undocumented and also produces a scary display result:This looks like my user just got wiped. Fortunately it's not the case, as
wp user get
confirmed.Describe how other contributors can replicate this bug
See commands above.
Describe what you would expect as the correct outcome
a)
user remove-role
should not proceed without a[role]
parameter b) matchset-role
strategy and remove default role + add documentationLet us know what environment you are running this on