From ec78e5eb8d13e23178f81d4e265f9a9b356445ef Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tobias=20H=C3=B6=C3=9Fl?= Date: Wed, 18 Apr 2012 06:12:46 +0000 Subject: [PATCH] Synchronize all Likes --- facebook/facebook.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/facebook/facebook.php b/facebook/facebook.php index aa388a17..ee6780b5 100644 --- a/facebook/facebook.php +++ b/facebook/facebook.php @@ -1561,9 +1561,19 @@ function fb_consume_status(&$a, &$user, &$entry, &$self, $fb_id, $wall, &$orig_p foreach ($j->comments->data as $cmnt) fb_consume_comment($a, $user, $self, $fb_id, $wall, $orig_post, $cmnt); - if (isset($j->likes) && isset($j->likes->data)) - foreach ($j->likes->data as $likers) - fb_consume_like($a, $user, $self, $fb_id, $wall, $orig_post, $likers); + if (isset($j->likes) && isset($j->likes->data) && isset($j->likes->count)) { + if (count($j->likes->data) == $j->likes->count) { + foreach ($j->likes->data as $likers) fb_consume_like($a, $user, $self, $fb_id, $wall, $orig_post, $likers); + } else { + $t = fetch_url('https://graph.facebook.com/' . $entry->id . '/likes?access_token=' . $access_token); + if ($t) { + $k = json_decode($t); + if (isset($k->data)) + foreach ($k->data as $likers) + fb_consume_like($a, $user, $self, $fb_id, $wall, $orig_post, $likers); + } + } + } } } -- 2.39.5