关于facebook评论插件的一个简单的问题 [英] A simple question about facebook comments plugin

查看:427
本文介绍了关于facebook评论插件的一个简单的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个非常简单的问题。 Facebook文档,一如既往,没有给我足够的解释。

I'm struggling with a very simple problem. The facebook documentation, as always, didn't give me enough explanation.

我在我的网站上附加了一个Facebook评论插件。使用comment.create事件的回调,我可以获得刚刚创建的注释的信息。

I attached a facebook comments plugin to my site. And using a callback of "comment.create" event, I can get information of a just-create comment.

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

json响应如下所示:

The json reponse looks like:

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

我现在想做的是使用commentID检索单个注释的数据。虽然我预期以下方式应该工作:

What I like to do now is to retrieve the data of the single comment with the commentID. Although I expected that the following way should work:

https://graph.facebook.com/111122223333

它只是给了我False。我可以使用以下方式检索附加到该网页的所有评论:

it just gave me "False". I can retrieve all comments attached to that page using:

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

但是,什么是正确的方式检索单评论数据刚刚使用commentID创建?

But, what is the right way to retrieve the single comment data just created using the commentID?

推荐答案

我也面临同样的问题...所以我做的是,使用fql查询最后发布的评论或从fb注释表回复。这里我按照时间降序排列评论,并选择顶部。虽然可以认为如果两个评论同时发布,可能会导致歧义,但在我的情况下,我尝试和测试它收入超过2个用户,但我总是得到预期的结果。

I was also facing the same problem... so what i did was , I queried the last posted comment or reply from the fb comments table using fql. Here I sort the comments by time in descending order and pick the top one. though one may think that if two comments are posted at same time, it may cause ambiguity, But in my case i tried and tested it invoving more than 2 users but i 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)
      }
    );
  });  

这篇关于关于facebook评论插件的一个简单的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆