diff --git a/local/class-cli.php b/local/class-cli.php index a5c4195ba8..9755172f1d 100644 --- a/local/class-cli.php +++ b/local/class-cli.php @@ -7,7 +7,6 @@ namespace Activitypub\Development; -use Activitypub\Collection\Actors; use Activitypub\Collection\Followers; use Activitypub\Comment; @@ -26,11 +25,11 @@ class Cli extends \WP_CLI_Command { * * ## OPTIONS * - * - * The URL of the actor to add as a follower. + * + * The URL or Webfinger of the actor to add as a follower. * - * [--user=] - * The user to add the follower to. Defaults to the blog actor. + * [--user=] + * The WordPress user to add the follower to. Omit to add to blog actor. * --- * default: 0 * --- @@ -38,17 +37,16 @@ class Cli extends \WP_CLI_Command { * ## EXAMPLES * * $ wp activitypub add_follower https://example.com/@user - * $ wp activitypub add_follower https://example.com/@user --user=1 + * $ wp activitypub add_follower user@example.com --user=1 * $ wp --user=pfefferle activitypub add_follower https://example.com/@user * - * @synopsis [--user=] + * @synopsis [--user=] * - * @param array $args The arguments. - * @param array $assoc_args The associative arguments. + * @param array $args The arguments. */ - public function add_follower( $args, $assoc_args ) { + public function add_follower( $args ) { $actor_url = $args[0]; - $user_id = get_flag_value( $assoc_args, 'user', Actors::BLOG_USER_ID ); + $user_id = get_current_user_id(); \WP_CLI::log( sprintf( 'Adding follower %s to user %d...', $actor_url, $user_id ) ); $result = Followers::add( $user_id, $actor_url );