How to fix comments plugin from facebook uncaught error? [closed] - facebook-comments

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
Today my site stopped showing the Facebook Comments and I'm receiving this error on the console:
sdk.js:67 Uncaught a {message: "The passed argument was of invalid type.", innerError: undefined}
I've tried to update the version in my localhost and it worked, but then when I deployed the code nothing happened.
For reference, these are the codes I've implemented in my Wordpress installation:
header.php
<!-- Facebook SDK -->
<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 = 'https://connect.facebook.net/pt_BR/sdk.js#xfbml=1&version=v2.12&appId=<?php $_ENV['
FACEBOOK_APP_ID '] ?>&autoLogAppEvents=1';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
single.php
<?php if ( comments_open() ) : ?>
<div class="fb-comments" data-href="<?php home_url( $wp->request ) ?>" data-width="100%" data-numposts="5"></div>
<?php endif; ?>

Related

How To Find All Comments In Dynamically Generated Facebook Comment Boxes

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?

Moderate Facebook comments

It seems I'm unable to moderate the Facebook comments of the Facebook comments plug-in.
Bellow the code that we initialy created. As you can see an appId is associated with it. Also, if you vist the page (http://amstelveenz.nl/armageddon/) there is one Facebook comment.
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function () {
FB.init({
appId: '1389836761336596',
xfbml: true,
version: 'v2.3'
});
};
(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>
<div class="facebook-comments">
<!-- facebook comments -->
<div class="fb-comments" data-href="<?php echo get_permalink(); ?>" data-width="100%" data-numposts="5" data-colorscheme="light"></div>
<!-- einde facebook comments -->
</div>
When visiting https://developers.facebook.com/tools/comments to manage the comments I'm unable to the comments made on the website.
Also when visiting the page I don't see the moderator view.
The solution I came across quite often was to add the following lines:
<meta property="fb:app_id" content="1389836761336596"/>
<meta property="fb:admins" content="712359589"/>
Ofcourse with my app_id and user_id. This also didn't result in a solution.
Any suggestions?
You need to specify fb:admins on your site to tell us who should be able to admin the comments

Facebook comments not working on Wordpress

I added Facebook Comment Box to my site manually. I created an app and pasted the code on my template files.
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : '730627806953221', // App ID from the app dashboard
status : true, // Check Facebook Login status
xfbml : true // Look for social plugins on the page
});
// Additional initialization code such as adding Event Listeners goes here
};
// Load the SDK asynchronously
(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";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
Then I added this:
<div class="fb-comments" data-href="<?php the_permalink(); ?>" data-width="430" style="max-width: 100%;"></div>
It seems to work, when a user comments it displays correctly. However when I try to reply to someone who left a comment it doesn´t stay there. I´m trying to reply as a brand not as myself.
Why could this be?

Facebook LIkebox Code loads when in html file but not when in body of Wordpress page

I've been trying to figure out why the code for my likebox will not work when I paste it into my page but it will load just fine when the same code is used in an html file. I got the code from the official facebook dev generator. The script code is in header.php and the code with the div that should call the js up is in the body of the message as raw html. Still, I'm getting nothing.
Has anyone else experienced this?
The following code will work when loaded from my computer. Will not work when I upload the same file to (loft3.com/hp.html) or when I try to use the code in header.php and call the second part in my post.
<html>
<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 = "http://connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-like-box" data-href="http://www.facebook.com/hp" data-width="800" data-show-faces="true" data-header="false" data-stream="true" data-show-border="false"></div>
</body>
</html>

Facebook Like button getting disappeared when clicked

The like button is getting disappeared when user clicks on the button.
Code used
<div id="fb-root" style="display:none">1</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_GB/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div class="winefacebook" style="float:left;">
<fb:like send="false" layout="button_count" show_faces="false" >.</fb:like>
</div>
Can anyone suggest a solution to this isue?
Many Thanks
As far as I understand Facebook Like button is now working with problems because of some minor system issues. This bug is reported quite often at their support forum. I'm afraid you can't really do anything with this until they will fix this.
The only thing I can suggest is to check your site with their debugger http://developers.facebook.com/tools/debug
Good luck.