# activitypub/1.3.0/includes/handler/class-undo.php

ActivityPub, version 1.3.0. 32 lines.

- Page: https://pluginprobe.com/plugins/activitypub/1.3.0/code/includes/handler/class-undo.php
- Raw: https://pluginprobe.com/plugins/activitypub/1.3.0/raw/includes/handler/class-undo.php
- Modified: 2023-12-05T13:18:30+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/activitypub/1.3.0/code/includes/handler/class-undo.php#L10-L20`.

```php
<?php
namespace Activitypub\Handler;

use Activitypub\Collection\Followers;

/**
 * Handle Undo requests
 */
class Undo {
	/**
	 * Initialize the class, registering WordPress hooks
	 */
	public static function init() {
		\add_action( 'activitypub_inbox_undo', array( self::class, 'handle_undo' ), 10, 2 );
	}

	/**
	 * Handle "Unfollow" requests
	 *
	 * @param array $activity The JSON "Undo" Activity
	 * @param int   $user_id  The ID of the ID of the WordPress User
	 */
	public static function handle_undo( $activity, $user_id ) {
		if (
			isset( $activity['object']['type'] ) &&
			'Follow' === $activity['object']['type']
		) {
			Followers::remove_follower( $user_id, $activity['actor'] );
		}
	}
}

```
