wp-cli / ideas

💡 Ideas and feature requests are collected here
40 stars 1 forks source link

User Site List in Network/Multisite #153

Closed danbeach closed 2 months ago

danbeach commented 3 years ago

Maybe this is already something that can be done, but I haven't found any simple or efficient way of doing this, so...

I think it would be great if there were a CLI command (likely wp user) that lists the sites a user is a member of in a multisite. Essentially, something that replicates the output of when you search for a user at the network level and it shows which (sub)sites that user is a member.

I know something can be done via shell, looping through the list of sites and checking for membership/role in each site, but that's time-consuming and clearly there's already functionality written that multisite uses in the GUI.

I imagine something like: $ wp user site-list user

ID | Sites 1 | www.site.com/subsite1 3 | www.site.com/subsite3 8 | www.site.com/subsite8

where it would be possible to use --field=site output as a --url= parameter to then update or remove the user from the site.

It would be an added bonus if the same could output what roles the user has in the site, but that part is easy and already exists if I can quickly get the list of sites to check.

danielbachhuber commented 7 months ago

Thanks for the suggestion, @danbeach !

This seems like it would be a reasonable command. I'd suggest implementing it as a filter on wp site list.

Feel free to submit a pull request, if you'd like. Here is some guidance on our pull request best practices. The command will need to live in https://github.com/wp-cli/entity-command/

marksabbath commented 7 months ago

Will work on this.

ernilambar commented 2 months ago

Fixed in https://github.com/wp-cli/entity-command/pull/438