Wordpress FB plugin missing comments box - facebook

I was using the Facebook Comments for Wordpress plugin and had FB comments working perfectly for my posts. I switched to the new Facebook plugin and everything works but the comments.
When I check my HTML source of my post pages I find the comments section empty. I know I'm missing something just don't know what it is. My site is cops.com and there should be comments on every post.

The WordPress plugin includes the functionality for comments. So there could be a clash that is occurring with your personal implementation of the plugin.
Go to the settings and enable the comments and disable your implementation (unless it is custom).
/wp-admin/admin.php?page=facebook-settings
I believe only one admin can/should be in control of these settings, there is one variable holding this information in the WP database so if two admins are in, one can overwrite the settings of another.
Also you have two instances of the SDK
<script type="text/javascript">window.fbAsyncInit=function(){FB.init({"appId":"293125297449760","channelUrl":"http:\/\/www.cops.com\/?fb-channel-file=1","status":true,"cookie":true,"xfbml":true,"oauth":true});}</script>
and
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '293125297449760', // App ID
channelUrl : '//www.cops.com/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// Additional initialization code here
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
</script>

If anything else work for you you can try with this other plugin
http://mydibbler.com/fbGroupPoster.html
This will help you build up more likes and share of your page in FB

I had the same problem that the comments weren't appearing. First the comment about editing all Pages to 'Allow Comments' for all pages was very useful, which pointed in me in the right direction.
My problem was actually that the theme I was using wasn't including comments in the page.php in the theme.
In my theme the comments_template wordpress function was missing inside The Loop.
So I had to add <?php comments_template( '', true ); ?> to the following code:
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); // begin 'The Loop' ?>
<?php the_content(); ?>
...
<?php comments_template( '', true ); ?>
<?php endwhile; // End 'The Loop' ?>

Related

facebook tab iframe specific page open

i just want to ask, i have a Facebook tab , which opens a small website like an frame in this tab , how can i add a link to the tab for a specific page in the frame "" lets say for example tab frame have 3 pages "home , about us , contact us" how can i add a share button which redirect me to this tab and i find contact us opened.
knowing that using static frame app .
and this is my code
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : '535262793177723', // App ID from the app dashboard
channelUrl : 'http://bridgestone.thesocialclinic-server.com/', // Channel file for x-domain comms
status : true, // Check Facebook Login status
xfbml : true // Look for social plugins on the page
});
FB.Canvas.scrollTo(0,0); };
// 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'));
function mohammad(){FB.Canvas.scrollTo(0,0);}
</script>
<script type="text/javascript">
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
</script>
<iframe src="http://bridgestone.thesocialclinic-server.com" scrolling="no" style="border:none;" width="100%" height="2000" onload="mohammad()"></iframe>
You would need app_data URL parameter, and use a link such as http://www.facebook.com/[page_name]/?sk=app_[app_id]&app_data=[specific_page]
Where app_data will be in the 'signed_request'. So you set app_data=page3, and check the parsed signed request value of app_data, and perform a redirect within your app.
After A lot of testing and checking , the result was that i was using static HTML application to add a new tab and get some benefit from fan gate etc...
but that was the problem , after creating the tab in the normal way without any application it worked like a charm.
thank you cdbconcepts for your help .

Simple Facebook login script not working

I am trying to have the user login to facebook and then display their user id in an alert.
Yet, I get nothing returned by this code. What am I doing wrong?
<html>
<head>
<title>Login to Facebook</title>
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'APP ID',
channelUrl : 'http://www.mydomain.net/zoozTest/channel.html',
status : true,
cookie : true,
xfbml : true,
oauth : true,
});
};
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
//LOGIN FUNCTION
function login() {
FB.login(function(response) {
if (response.authResponse) {
alert('Success!');
}else{
alert('Login Failed!');
}
}, {scope: 'email'});
}
</script>
<div onclick="login();">Login with Facebook</div>
</body>
</html>
Your code, copied verbatim, works fine for me. Three things:
1: Stupid question, but you've replaced 'APP ID' with your actual app id, right? Otherwise that'll be an error
2: Check your app settings. Have you specified your app domain and 'website with facebook login' URL correctly?
3: Technically you have a race condition. If you click the 'Login with Facebook' div and attempt to run your login() function before the FB JS SDK has initialised (it loads asynchronously), you'll get an error as the global FB object won't be defined. I'd stick a console.log at the bottom of the window.fbasyncinit function to make sure FB is being defined (for testing, for production you'll likely want to either block the login from showing before Facebook is inited, or build some sort of queue that checks to see if the global FB object is defined before attempting to use it, and if not adds to a queue).
Do you have any errors in the javascript console?

Cancelling from Facebook Permissions dialog redirects and does not close

I am trying to add Facebook login functionality to my web site using Javascript.
I have called FB.init and FB.login and get the expected popup window that asks me to log in with my Facebook credentials. The call to FB.login requests user_birthday and email permissions so I also get the expected dialog that asks me to allow those permissions. If I accept, the login works and control returns to my parent page.
If I do not accept the permissions (hit the Cancel button), what happens next seems to be inconsistent. What I was hoping was that the popup window would go away and return control to the parent window which would then be able to handle the denied response. Ultimately I want to give my users a message letting them know what happens when they cancel.
Instead, I sometimes see the popup window redirect to the main Facebook page that you see when you log directly into Facebook. Sometimes the popup window becomes blank and just sits there (it is pointing to the ChannelUrl page that I specified in the FB.init call). In both cases, control is not returned to the parent page until I manually close the popup window.
Sample Code:
<html>
<body>
<div id="fb-root"></div>
<script language="Javascript">
window.fbAsyncInit = function() {
FB.init({
AppId : 'XXXXXXX',
channelUrl: 'http://www.mydomain.com/channel.html', //custom channel
status: true,
cookie: true,
xfbml: true,
oauth: true
});
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document))
function fbLogin()
{
FB.login(function (response){
if (response.authResponse) {
Debug("Auth Logged in");
}
else
{
Debug("Auth failed");
}
}, {scope:'user_birthday,email'});
}
function Debug(psMessage)
{ // something to provide feedback on what happened...
var objDebug = document.getElementById("Debug");
var objDate = new Date();
var sTime = objDate.getHours() + ":" + objDate.getMinutes() + ":" + objDate.getSeconds();
objDebug.innerHTML = sTime + " - " + psMessage + "<br>" + objDebug.innerHTML;
}
</script>
<form>
<input type="button" value="Log in" onClick="fbLogin();">
<br>
<br>
<br>
<br>
<div id="Debug"></div>
</form>
</body>
</html>
I have tried a variety of things. I have deleted and created a new application. I created the channelUrl parameter (it only includes
<script src="//connect.facebook.net/en_US/all.js"></script>).
Does anyone have any insight as to what I’m doing wrong (this seems to happen at least in IE8, Safari 5.0.5, and Firefox 11.0 all on Windows XP)?
Thanks for any help!
I know this is an old thread, but hopefully my solution will help people that facing the same problem.
If you use old Facebook Apps Dashboard, disable your Sandbox Mode.
If you use new Facebook Apps Dashboard, click Status and Review (on left sidebar) and change the '...available to general public' from No to Yes.
Hope this might help. Goodluck ;)

Caching Facebook Like Box?

I'm using the Like Box code from Facebook and I noticed it hinders my page load. After looking in Firebug it loads a bunch of Javascript and CSS files. I'm wondering is there a way to cache the Facebook Like box? I did search Google but the only one I saw was for Wordpress. I'm using php.
I used #Martin link to find this link https://developers.facebook.com/docs/reference/javascript/
The following code was modified to fit my situation, but I am not sure how much quicker it is or if the cache is working properly.
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.php', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// Additional initialization code here
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
</script>
My channel.php looks like this, also from the same page:
<?php
$cache_expire = 60*60*24*365;
header("Pragma: public");
header("Cache-Control: max-age=".$cache_expire);
header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$cache_expire) . ' GMT');
?>
<script src="//connect.facebook.net/en_US/all.js"></script>
Hope that helps add to the solution.
There's a way to do this: Use channel file and cache it as much as possible. Read more about it here

Facebook Login link auto refresh to facebook user profile link and picture

I am trying to make a WordPress submit form using Gravity Forms where the visitors see a "Login with Facebook" button.
Once the visitor logs in and grants the permission, the section then refreshes to show the Facebook user profile link and picture, letting the visitor know that they are submitting with the Facebook profile.
I have already copied the codes but I need some help to complete it.
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'XXXXXXXXXXXXXXXXX', // App ID
channelUrl : '//www.MY-DOMAIN.com/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// Additional initialization code here
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
</script>
<script>
FB.api('/me', function(user) {
if (user) {
var image = document.getElementById('image');
image.src = 'http://graph.facebook.com/' + user.id + '/picture';
var name = document.getElementById('name');
name.innerHTML = user.name
}
});
</script>
Now, what do I put to get the section where I can show a "login button" and then show the user profile link after someone logs in?
For log-in you may use one of:
FB.login method of JavaScript SDK
Login Button (which have HTML5/XFBML/Iframe version)
Your call the to API is too premature in the page load. First it need to be done after facebook scripts are ready to be run. You can put the code into the fbAsyncInit() function. Secondly, you should follow this paradigm to ensure the user is logged into your app, see: https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/