Quantcast
Viewing all articles
Browse latest Browse all 60

Check if user has liked a post or not with Facebook Graph API

I want to design a news feed with fully functioning likes/Unlike ,share and commenting,and of course fetching recent posts from users newfeed.Now here is the thing,I want to check whether a user has liked a post (type is video, photo, link or status).

If a user has liked the post already, then show unlike button, if a user has not liked, show like button.

FILES:

index.php click to open the file

Now there are few problems here: 1- problem is that when ever i run this code,it shows only one post from newsfeed.but if i remove the following code from the code,it will fetch 20 posts from newsfeed .i dont know whats happening.

$ret = $facebook->api(array(
'method' => 'fql.query',
'query' => "SELECT like_info FROM $type WHERE object_id=$object_id"
 ));
 $checklike = $ret['data']['like_info']['user_likes'];

2-we can use object_id only for photos,albums,and videos.but you cant use it to get like_info fro link and status types.so i need new way and a new technique to findout wether user has liked an post or not

3-whenever i add a new $facebook->api() inside the foreach loop,it will fetch 1-3 posts from fb or even not all.

so if you could find anyway to make a news feed with fully functioning likes/Unlike ,share and commenting,and of course fetching recent posts from users newfeed OR fixing the problems i mentioned ,That would be greatful.

please help me as soon as possible,if you need anything ,just comment and i will provide you with.

Thanks.


Viewing all articles
Browse latest Browse all 60

Trending Articles