Skip to content

User Site List in Network/Multisite #153

@danbeach

Description

@danbeach

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions