From 0fa7fc62f768c775c5b13dc3c67abfa224d46e11 Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Sun, 17 Feb 2019 21:09:24 +0100 Subject: [PATCH] fix #25 --- includes/class-db-activitypub-followers.php | 25 ++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/includes/class-db-activitypub-followers.php b/includes/class-db-activitypub-followers.php index a9b61f9..5b163f9 100644 --- a/includes/class-db-activitypub-followers.php +++ b/includes/class-db-activitypub-followers.php @@ -3,7 +3,30 @@ class Db_Activitypub_Followers { public static function get_followers( $author_id ) { - return get_user_option( 'activitypub_followers', $author_id ); + $followers = get_user_option( 'activitypub_followers', $author_id ); + + if ( ! $followers ) { + return $followers; + } + + if ( count( $array ) == count( $array, COUNT_RECURSIVE ) ) { + return $followers; + } + + foreach ( $followers as $key => $follower ) { + if ( + is_array( $follower ) && + isset( $follower['type'] ) && + 'Person' === $follower['type'] && + isset( $follower['id'] ) && + true === filter_var( $follower['id'], FILTER_VALIDATE_URL ) + ) { + unset( $followers[$key] ); + $followers[] = $follower['id']; + } + } + + return $followers; } public static function add_follower( $actor, $author_id ) {