wp-cli / entity-command

Manage WordPress comments, menus, options, posts, sites, terms, and users.
MIT License
100 stars 90 forks source link

list user --network excludes role from results #107

Open tomwhita opened 7 years ago

tomwhita commented 7 years ago

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.

danielbachhuber commented 7 years ago

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.

BhargavBhandari90 commented 2 years ago

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

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

danielbachhuber commented 2 years ago

@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.