Open tomwhita opened 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.
@danielbachhuber Do we need to add this in the Example here?
wp site list --field=url | xargs -n1 -I % wp --url=% user list
@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.
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.