Skip to content

Commit

Permalink
Change filter to user__in
Browse files Browse the repository at this point in the history
  • Loading branch information
marksabbath committed Nov 13, 2023
1 parent e08c6e4 commit 399c882
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions features/site.feature
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ Feature: Manage sites in a multisite installation
And I run `wp user get {USER_ID} --field=user_login`
And save STDOUT as {USER_LOGIN}

When I run `wp site list --field=url --site__user_in={USER_LOGIN}`
When I run `wp site list --field=url --user__in={USER_LOGIN}`
Then STDOUT should be:
"""
{SITE_URL}
"""

When I try `wp site list --site__user_in=invalid_user`
When I try `wp site list --user__in=invalid_user`
Then the return code should be 1
And STDERR should be:
"""
Expand Down
6 changes: 3 additions & 3 deletions src/Site_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ private function get_network( $network_id ) {
* [--site__in=<value>]
* : Only list the sites with these blog_id values (comma-separated).
*
* [--site__user_in=<value>]
* [--user__in=<value>]
* : Only list the sites with this user.
*
* [--field=<field>]
Expand Down Expand Up @@ -610,8 +610,8 @@ public function list_( $args, $assoc_args ) {
$where['site_id'] = $assoc_args['network'];
}

if ( isset( $assoc_args['site__user_in'] ) ) {
$user = get_user_by( 'login', $assoc_args['site__user_in'] );
if ( isset( $assoc_args['user__in'] ) ) {
$user = get_user_by( 'login', $assoc_args['user__in'] );

if ( $user ) {
$blogs = get_blogs_of_user( $user->id );
Expand Down

0 comments on commit 399c882

Please sign in to comment.