remove followers
This commit is contained in:
parent
32194c31df
commit
3c86e94d9a
3 changed files with 18 additions and 5 deletions
|
@ -199,6 +199,10 @@ class Followers {
|
||||||
wp_set_object_terms( $user_id, $actor, self::TAXONOMY, true );
|
wp_set_object_terms( $user_id, $actor, self::TAXONOMY, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function remove_follower( $user_id, $actor ) {
|
||||||
|
wp_remove_object_terms( $user_id, $actor, self::TAXONOMY );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undocumented function
|
* Undocumented function
|
||||||
*
|
*
|
||||||
|
@ -225,7 +229,7 @@ class Followers {
|
||||||
* @param int $user_id
|
* @param int $user_id
|
||||||
* @param int $number
|
* @param int $number
|
||||||
* @param int $offset
|
* @param int $offset
|
||||||
* @return array The Term list of followers
|
* @return array The Term list of Followers
|
||||||
*/
|
*/
|
||||||
public static function get_followers( $user_id, $number = null, $offset = null ) {
|
public static function get_followers( $user_id, $number = null, $offset = null ) {
|
||||||
//self::migrate_followers( $user_id );
|
//self::migrate_followers( $user_id );
|
||||||
|
|
|
@ -59,8 +59,7 @@ class Followers extends WP_List_Table {
|
||||||
|
|
||||||
public function get_bulk_actions() {
|
public function get_bulk_actions() {
|
||||||
return array(
|
return array(
|
||||||
'revoke' => __( 'Revoke', 'activitypub' ),
|
'delete' => __( 'Delete', 'activitypub' ),
|
||||||
'verify' => __( 'Verify', 'activitypub' ),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,6 +78,16 @@ class Followers extends WP_List_Table {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function column_cb( $item ) {
|
public function column_cb( $item ) {
|
||||||
return sprintf( '<input type="checkbox" name="tokens[]" value="%s" />', esc_attr( $item['identifier'] ) );
|
return sprintf( '<input type="checkbox" name="followers[]" value="%s" />', esc_attr( $item['identifier'] ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function process_action() {
|
||||||
|
$followers = isset( $_REQUEST['followers'] ) ? $_REQUEST['followers'] : array(); // phpcs:ignore
|
||||||
|
|
||||||
|
switch ( $this->current_action() ) {
|
||||||
|
case 'delete':
|
||||||
|
FollowerCollection::remove_follower( \get_current_user_id(), $followers );
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<?php $token_table = new \Activitypub\Table\Followers(); ?>
|
<?php $token_table = new \Activitypub\Table\Followers(); ?>
|
||||||
|
|
||||||
<form method="get">
|
<form method="get">
|
||||||
<input type="hidden" name="page" value="indieauth_user_token" />
|
<input type="hidden" name="page" value="activitypub-followers-list" />
|
||||||
<?php
|
<?php
|
||||||
$token_table->prepare_items();
|
$token_table->prepare_items();
|
||||||
$token_table->display();
|
$token_table->display();
|
||||||
|
|
Loading…
Reference in a new issue