OSDN Git Service

Update to accommodate scenario when multiple users are passed
authorDaniel Bachhuber <d@danielbachhuber.com>
Sun, 14 Jul 2013 02:12:00 +0000 (19:12 -0700)
committerDaniel Bachhuber <d@danielbachhuber.com>
Sun, 14 Jul 2013 02:12:00 +0000 (19:12 -0700)
See https://github.com/wp-cli/wp-cli/pull/555#discussion_r5179695

php/commands/user.php

index d4b23b3..102e179 100644 (file)
@@ -66,7 +66,9 @@ class User_Command extends \WP_CLI\CommandWithDBObject {
                        'reassign' => null
                ) );
 
-               $args[0] = self::get_user_from_first_arg( $args[0] )->ID;
+               foreach( $args as $key => $arg ) {
+                       $args[$key] = self::get_user_from_first_arg( $arg )->ID;
+               }
                parent::delete( $args, $assoc_args );
        }
 
@@ -150,7 +152,9 @@ class User_Command extends \WP_CLI\CommandWithDBObject {
         */
        public function update( $args, $assoc_args ) {
 
-               $args[0] = self::get_user_from_first_arg( $args[0] )->ID;
+               foreach( $args as $key => $arg ) {
+                       $args[$key] = self::get_user_from_first_arg( $arg )->ID;
+               }
                parent::update( $args, $assoc_args, 'user' );
        }