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

list user --network excludes role from results

Open tomwhita opened this issue 8 years ago • 3 comments

When running wp user list --network, the following fields are returned by default:

ID,user_login,display_name,user_email,user_registered

"roles", which listed in the documents as a default field is not being returned. It is returned when running wp user list but if multisite only users from the primary site are returned.

Please advise if there is an existing method to obtain all network users by role.

tomwhita avatar Nov 01 '17 16:11 tomwhita

Please advise if there is an existing method to obtain all network users by role.

There is not, because users can have different roles on different sites. We'll include some mention in the documentation to this effect.

To generate a list of all users with a given role, you'd need to list users for each site (see reference doc) and concatenate the list you've generated.

danielbachhuber avatar Nov 01 '17 16:11 danielbachhuber

@danielbachhuber Do we need to add this in the Example here?

wp site list --field=url | xargs -n1 -I % wp --url=% user list

BhargavBhandari90 avatar Aug 21 '22 11:08 BhargavBhandari90

@BhargavBhandari90 I think the example will need to be a bit more involved to conclusively document this:

To generate a list of all users with a given role, you'd need to list users for each site (see reference doc) and concatenate the list you've generated.

danielbachhuber avatar Aug 22 '22 19:08 danielbachhuber