Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions local/class-cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

namespace Activitypub\Development;

use Activitypub\Collection\Actors;
use Activitypub\Collection\Followers;
use Activitypub\Comment;

Expand All @@ -26,29 +25,28 @@ class Cli extends \WP_CLI_Command {
*
* ## OPTIONS
*
* <actor_url>
* The URL of the actor to add as a follower.
* <actor>
* The URL or Webfinger of the actor to add as a follower.
*
* [--user=<user>]
* The user to add the follower to. Defaults to the blog actor.
* [--user=<id|login|email>]
* The WordPress user to add the follower to. Omit to add to blog actor.
* ---
* default: 0
* ---
*
* ## 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 <actor_url> [--user=<user>]
* @synopsis <actor> [--user=<id|login|email>]
*
* @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 );
Expand Down