Simple question about facebook comment plugin

I am struggling with a very simple problem. The facebook documentation, as always, did not give me enough explanation.

I have attached the facebook comments plugin to my site. And using the comment.create event callback, I can get information about the comment just being created.

FB.Event.subscribe('comment.create', function(response) { alert(JSON.stringify(response)); }); 

The json answer looks like this:

 {"href":"http://siteaddress.com/page.htm", "commentID":"111122223333" } 

Now I like to get the data of one comment using commentID. Although I was expecting the following path to work:

 https://graph.facebook.com/111122223333 

he just gave me False. I can get all the comments attached to this page using:

 https://graph.facebook.com/comments?ids=http://siteaddress.com/page.htm 

But what is the correct way to get single comment data created only with commentID?

+4
source share
5 answers

I also ran into the same problem ... so what I did was, I requested the last sent comment or response from the fb comment table using fql. Here I sort the comments by time in descending order and select the top one. although you might think that if two comments are published at the same time, this may cause ambiguity, but in my case I tried and tested it by adding more than two users, but always got the expected result.

 FB.Event.subscribe('comment.create', function(response) { FB.api({ method: 'fql.query', query: "select post_fbid, fromid, object_id, text, time from comment where object_id in (select comments_fbid from link_stat where url ='URL_OF_THE_COMMENT_BOX') or object_id in (select post_fbid from comment where object_id in (select comments_fbid from link_stat where url ='URL_OF_THE_COMMENT_BOX')) order by time desc limit 1" }, function(response) { var feed = response[0]; alert(feed.text) } ); }); 
+9
source

Hi, if you have a comment identifier, then why don’t you use FQL and query the Comment Table to get all the data associated with the comments?

0
source

I have the same problem. It seems to happen that commentID and parentCommentID actually just return the unique identifier of this page, and not the unique identifier for the comment itself.

The unique identifier for a single comment is the unique identifier of the page (that is, the value that is currently returned as "commentID") with an underscore followed by a different number (8 digits in the tests I did), you can see this directly from schedule provided to them.

I registered a bug with Facebook to hope this is fixed! Error at the address below:

http://bugs.developers.facebook.net/show_bug.cgi?id=16535

0
source

Hm. I can get comment data by id (id format as follows: 1234567890123456_12345678). Ids are returned from url as follows: https://graph.facebook.com/comments?ids= {$ url}

0
source

I combined a couple of approaches (including from Charsee).

// this request accepts "commentID" and "href". Comment ID is returned on comment.create

// this code requires the escape function "addslashes (str)" to handle single quotes.

var query = "SELECT text, fromid FROM comment WHERE post_fbid = '" + addslashes (commentID) + "' AND (object_id in (select comments_fbid from link_stat where url = '" + addslashes (href) + "')) or object_id in ( select post_fbid from the comment where object_id in (select comments_fbid from link_stat, where url = '"+ addslashes (href) +"'))) ";

0
source

Source: https://habr.com/ru/post/1344555/


All Articles