Renato
Renato

Reputation: 505

comments plugin query

I'm developing a website that connects to Facebook. The website uses the comments social plugin to allow the users comments the content of each page from the site. Now I'm looking for a way to query the most commented pages, but looking the FQL documentation I didn't found any way of count records nor get the most popular urls from my website.

If someone have some clue to accomplish that task I would be thankful.

Upvotes: 0

Views: 323

Answers (1)

DMCS
DMCS

Reputation: 31870

Two options

OPTION 1

FQL the comments table: http://developers.facebook.com/docs/reference/fql/comment/

SELECT post_fbid, fromid, object_id, text, time \
FROM comment \
WHERE object_id IN \
  (SELECT comments_fbid \
   FROM link_stat \
   WHERE url ='http://developers.facebook.com/docs/reference/fql/comment/')

To process multiple URLs at a time you can run a FQL multi-query.

OPTION 2

Another option is to keep a running count of number of comments in your database. The comments plugin allows you to capture when someone leaves a comment. You can then increment a counter in your database for that url.

From: https://developers.facebook.com/docs/reference/plugins/comments/

How do I know when someone comments on my site?

You can subscribe to the 'comment.create' and 'comment.remove' events through FB.Event.subscribe.

Upvotes: 1

Related Questions