From c5e1f4212b99610386deb5d97b198aad7959a8ae Mon Sep 17 00:00:00 2001 From: Daniel Bachhuber Date: Tue, 25 Jun 2013 14:10:49 -0700 Subject: [PATCH] For most `wp user` subcommands, the first argument can be user ID or login --- php/commands/user.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/php/commands/user.php b/php/commands/user.php index 3533ec80..d4b23b3f 100644 --- a/php/commands/user.php +++ b/php/commands/user.php @@ -59,13 +59,14 @@ class User_Command extends \WP_CLI\CommandWithDBObject { /** * Delete one or more users. * - * @synopsis ... [--reassign=] + * @synopsis ... [--reassign=] */ public function delete( $args, $assoc_args ) { $assoc_args = wp_parse_args( $assoc_args, array( 'reassign' => null ) ); + $args[0] = self::get_user_from_first_arg( $args[0] )->ID; parent::delete( $args, $assoc_args ); } @@ -145,9 +146,11 @@ class User_Command extends \WP_CLI\CommandWithDBObject { /** * Update a user. * - * @synopsis ... --= + * @synopsis ... --= */ public function update( $args, $assoc_args ) { + + $args[0] = self::get_user_from_first_arg( $args[0] )->ID; parent::update( $args, $assoc_args, 'user' ); } @@ -212,7 +215,7 @@ class User_Command extends \WP_CLI\CommandWithDBObject { * Set the user role (for a particular blog). * * @subcommand set-role - * @synopsis [] + * @synopsis [] */ public function set_role( $args, $assoc_args ) { $user = self::get_user_from_first_arg( $args[0] ); @@ -232,7 +235,7 @@ class User_Command extends \WP_CLI\CommandWithDBObject { * Add a role for a user. * * @subcommand add-role - * @synopsis + * @synopsis */ public function add_role( $args, $assoc_args ) { $user = self::get_user_from_first_arg( $args[0] ); @@ -248,7 +251,7 @@ class User_Command extends \WP_CLI\CommandWithDBObject { * Remove a user's role. * * @subcommand remove-role - * @synopsis [] + * @synopsis [] */ public function remove_role( $args, $assoc_args ) { $user = self::get_user_from_first_arg( $args[0] ); -- 2.11.0