How To Find All Comments In Dynamically Generated Facebook Comment Boxes - facebook

Currently I am using a bit of code from Facebook to generate comment boxes on my site. I dynamically generate a different comment box for each article on the site -- and it works! -- but the problem is that I have SO many different comment boxes pointing to so many different URLs and I did not generate the comment boxes through any central Facebook app, so I am unsure how to check the users/comments that I receive in those boxes!
Below is the code that I use to generate the comment box on each page, with the $url variable is always equal to the URL that the comment box is being displayed on:
<div id="fb-root"></div>
<script>
(function(d, s, id)
{
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=";
fjs.parentNode.insertBefore(js, fjs);
(document, 'script', 'facebook-jssdk'));
</script>
<div class="fb-comments" data-href="<?php echo $url ?>" data-num-posts="12" data-width="100%"></div>
Is there any way to check for comments if this is how I generate my comment boxes?

Related

Facebook comments - Moderation link not showing

I set up Facebook comments on a staging site we have, however can't get the Moderation Link to show up:
http://telegram_com.wtstage.sx.atl.publicus.com/article/20150426/NEWS/304269695?nocache=1
I have confirmed that I'm an administrator on the Facebook app account.
I have this in the header:
<meta property="fb:app_id" content="1393680337622798" />
I have this in the body:
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3&appId=1393680337622798";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-comments" data-href="http://telegram.com/article/20150426/NEWS/304269695/101116" data-numposts="25" data-version="v2.3" data-colorscheme="light"></div>
I have tried using the live telegram.com url as well as the staging url.
If I swap the url (data-href) for another site I am an administrator on, the Facebook comment moderation link shows up in the comment widget. However if I use any url that is the telegram.com's, the Moderation link does not show up.
Is there a setting or something in Facebook's backend that I could be missing? It seems to me the code would be correct, if it works when I use the same app id, but a different data-href url.
Any suggestions?
I seem to have the same issue using the data-href attribute, however, switching to the init version of the comments plugin sorted my issue.
So now, I'm using the following towards the top of the page:
<script>
window.fbAsyncInit = function () {
FB.init({
appId: '516991728450336',
xfbml: true,
version: 'v2.3',
num_posts: 5,
width: '100%'
});
};
(function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) { return; }
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
And I've got a
<div class="fb-comments"></div>
Further down the page. This way, I don't even need the <meta property="fb:app_id"... either, as that only overrides the appId in the FB.init script.
You can specify the href attribute in the script to modify the URL, but if you don't, it'll just default to your page URL. Further parameters here
I hope it helps.

Facebook JS SDK not posting comments on timeline

I am using below code to implement facebook comment box on my site pages :
<div class="fb-comments" data-href="http://example.com/test/public/story/read-searched-story?story=rRDMpYpeHA22aFm4OFahuV50iFqswqjzFzl7BJPbnyo=" data-numposts="5" data-colorscheme="light"></div>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
When i am posting comment it asks to publish on facebook and when i click on post nothing happens either on my wall or activity log. any help will be appreciated..!!
After searching a lot found that facebook crawler needs some ogtags to crawl all pages mentioned on https://developers.facebook.com/docs/reference/opengraph/object-type/website/ and you can check your URL on https://developers.facebook.com/tools/debug/.

Facebook Comments Plugin Count - the stats comment count header is not showing

I added Facebook Comments to a WordPress blog. The comment box header (says x comments with a drop down arrow and an "add a comment" link) is not showing up. See the default comment box at https://developers.facebook.com/docs/plugins/comments/.
I inserted the following after the opening body tag:
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=1432741046964019";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
And the following function to load comments if comments are open:
function sitc_load_facebook_comments() {
if ( comments_open() ) {
echo '<div class="fb-comments" data-href="';
echo get_permalink();
echo '" data-numposts="5" data-colorscheme="light"></div>';
}
}
Not sure if there has to be over five comments in order for the header to show up?
Use this tag. Found on the FB comment doc :)
<fb:comments-count href=yourURL></fb:comments-count>

Facebook like button comment box not working with flickr

I have a js fiddle that demonstrates the issue
http://jsfiddle.net/RLQUR/
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-like" data-href="http://www.flickr.com" data-send="true" data-width="450" data-show-faces="true"></div>
The code in the fiddle is directly from the facebook like button generator.
If you change the url to something like "http://www.google.com" it works just as it should. However, when using a flickr url and trying to click "Post to Facebook" it makes an AJAX request and returns with a status of 200 OK but does not post the comment to the profile or close the popup.
I believe this is likely a bug with the facebook like button, however I am unable to create a bug on the developer page for an unknown reason. I do not see a "Create" button on the page.
Any help is appreciated.

Facebook share and comment boxes don't work together

I want to include Facebook share button and comment box to my website.
I have a code for share button:
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share"
type="text/javascript">
</script>
<a name="fb_share" type="icon" share_url="www.example.com"></a>
For comment box:
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1&appId=258471354227171";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-comments" data-href="www.example.com" data-num-posts="3" data-width="600"></div>
Separately it works perfect, but when i put it in one page just one of them is working. What is a problem?
I think the solution you need is here:
Facebook Like button sometimes appears sometimes not
Basically you need to add the FB.share script after all.js.