2011-03-06 68 views
0

任何帮助将深深感激,因为我已经尝试了所有我能想到的事情来实现这一目标,但无济于事。Facebook的新fb:评论和FB.Event.subscribe'comments.create'不工作

我正在使用Facebook的更新(截至上周)FB:评论系统,但无法获得FB.Event.subscribe'comments.create'和FB.Event.subscribe'comments.remove'的工作。

有问题的网页可以看到here

我异步初始化FB:

<script type="text/javascript"> 
//<![CDATA[ 
    window.fbAsyncInit = function() { 
    FB.init({appId: '191116444251564', status: true, cookie: true, xfbml: true}); 
    FB.Event.subscribe('comments.create', function (response) { 
// console.log('create', response); 
    //got response.... now query FQL to return total number of post counts 
    FB.api(
    { 
     method: "fql.query", 
     query: "SELECT count FROM comments_info WHERE xid='2_plain-basmati-rice---rice-cooker' and app_id='191116444251564'" 
    }, 
    function(fql_response) { 
     $j.post('/recipes/2_plain-basmati-rice---rice-cooker/commented', {count: fql_response[0].count}); 
    } 
); 
}); 

FB.Event.subscribe('comments.remove', function (response) { 
    //got response.... now query FQL to return total number of post counts 
// console.log('remove', response); 
    FB.api(
    { 
     method: "fql.query", 
     query: "SELECT count FROM comments_info WHERE xid='2_plain-basmati-rice---rice-cooker' and app_id='191116444251564'" 
    }, 
    function(fql_response) { 
     $j.post('/recipes/2_plain-basmati-rice---rice-cooker/commented', {count: fql_response[0].count}); 
    } 
); 
}); 

    }; 
    (function() { 
    var e = document.createElement('script'); 
    e.async = true; 
    e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; 
    document.getElementById('fb-root').appendChild(e); 
    }()); 
//]]> 
</script> 

用一个简单的警报( 'TST')不工作更换两个订阅回调。

我已经使用FB的linter测试了该页面,并且没有显示该特定页面的错误。

再次,我要感谢任何人可以提供任何提示或指针。

+0

我注意到你正在使用'SELECT count FROM comments_info WHERE ...'。这实际上是否有用于获得评论数量? – TMC 2011-04-27 11:38:55

+0

它曾经是我在大约一个月左右测试代码的时候......但是就Facebook的API而言,一个月就像100年一样,所以很有可能它不再有效......我?苦? FU *%$ * F! – Nazar 2011-04-28 19:43:45

回答

1

我认为Event.subscribe目前有点摇摇欲坠。上周(3月8日左右)我有类似的代码工作,但今天(3月13日)我注意到Event.subscribe并未解雇。顺便说一句,我认为它现在应该是comment.create,而不是comments.create。那是为我工作的。

+0

感谢一月 我看到FB都更新了他们FB.Event.Subscribe文档到comment.create。 很好的了解,它WASN我只是在做一些愚蠢的事情! – Nazar 2011-03-15 09:40:34

0

不可靠的消息人士称,Facebook的FQL即将更新,以适应新评论系统的功能......我们都在等待。

0

您阅读Facebook的文档?不幸的是这是一个很大的错误。
尝试用comments.add代替comments.create ...

+0

感谢Fabrice ....这就是我最初在新评论插件上周发布之前所做的。将测试。 – Nazar 2011-03-08 16:01:21

+0

从comments.create对不起..仍然没有喜悦,我.... :( – Nazar 2011-03-10 11:57:12

0

这是comment.create,应该工作。