Skip to content

Commit 0fa7fc6

Browse files
committed
fix #25
1 parent 6344e10 commit 0fa7fc6

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

includes/class-db-activitypub-followers.php

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,30 @@
33
class Db_Activitypub_Followers {
44

55
public static function get_followers( $author_id ) {
6-
return get_user_option( 'activitypub_followers', $author_id );
6+
$followers = get_user_option( 'activitypub_followers', $author_id );
7+
8+
if ( ! $followers ) {
9+
return $followers;
10+
}
11+
12+
if ( count( $array ) == count( $array, COUNT_RECURSIVE ) ) {
13+
return $followers;
14+
}
15+
16+
foreach ( $followers as $key => $follower ) {
17+
if (
18+
is_array( $follower ) &&
19+
isset( $follower['type'] ) &&
20+
'Person' === $follower['type'] &&
21+
isset( $follower['id'] ) &&
22+
true === filter_var( $follower['id'], FILTER_VALIDATE_URL )
23+
) {
24+
unset( $followers[$key] );
25+
$followers[] = $follower['id'];
26+
}
27+
}
28+
29+
return $followers;
730
}
831

932
public static function add_follower( $actor, $author_id ) {

0 commit comments

Comments
 (0)