I have a comments box under my node which works fine in Chrome but not Firefox or IE and I just get the following error displayed where the comment box should be

The comments plugin requires an application id to properly namespace the provided xid.

On the Facebook Comments Plugin page it suggest the code should be

<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=APPID&amp;xfbml=1"></script><fb:comments xid="xxxxxxxx" numposts="10" width="425" publish_feed="true"></fb:comments>

which suggests you now have to add your APPID into the url of all.js

I'm using $conf['fb_js_channel'] in settings.php so in my xd_receiver.html I have tried putting in

<script src="http://connect.facebook.net/en_US/all.js#appId=APPID&amp;xfbml=1"></script>

but this made no difference

Has anyone else come accross this?

Comments

marcus178’s picture

Just to elaborate further, in Firefox it only happens the first time the page is loaded, if you refresh the problem goes away, and in IE in happens most of the time but sometimes after a few refreshes it will display correctly.

I guessing it's something to do with have the all.js is loaded, maybe since it's changed to asynchronous, but not had chance to try an old version.

gheimburg’s picture

Make sure that your script and the code on your page complies with FaceBook's requirements. For instance, they are now requiring that <div id="fb-root"></div> be somewhere on the page for comments to work.

Their other script requirements are listed on this page: http://developers.facebook.com/docs/reference/javascript/

Hope that helps!

marcus178’s picture

<div id="fb-root"></div> 

is already on the page just before the async all.js

marcus178’s picture

Ok I've created a very simple html page with just comments using the same xid etc as one of my nodes and it works fine in all browsers so it got to be some to do with the DFF setup.

Dave Cohen’s picture

Do not add this:

<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=APPID&amp;xfbml=1"></script>

Because it will be added to the page automatically.

Only add this:

<fb:comments xid="xxxxxxxx" numposts="10" width="425" publish_feed="true"></fb:comments>
marcus178’s picture

That's exactly what I have but still get the error message.

It will load correctly sometimes, for example if I refresh the screen a few times the comments will load correctly on the odd occasion.

nonoan’s picture

Confirmed the same problem in Chrome as well.

The fact that loads ok sometimes and someother not, might be a problem related to script load?

Dave Cohen’s picture

I've never used the fb:comments tag with xid attribute, so personally I have not seen the problem, but I looked at http://developers.facebook.com/docs/reference/fbml/comments/ and I see fb:comments listed as "legacy FBML", meaning deprecated.

Facebook's MO is "hack", and not "test". It's quite possible the problem is on their end.

nonoan’s picture

Well, actually if you generate the code from the http://developers.facebook.com/docs/reference/plugins/comments/ it generates this which is XFBML (the new ML), it look like the AppID is inserted even without using a xid...

<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=APP_ID&amp;xfbml=1"></script><fb:comments numposts="10" width="425" publish_feed="true"></fb:comments>

Maybe now fb_app.mod is need to specify the APP_ID?

I'll keep researching...

Dave Cohen’s picture

modules/fb will provide the app id. Don't put the <div> or <script> tags in there. Only add the <fb:comments>.

nonoan’s picture

I can't get it to work... :-(
This is what I've done:
- I have enabled fb.module, fb_devel.module and fb_app.module (7.x-3.x-dev versions)
- I have provided fb_app with my app data (key, secret, etc.)

I have inserted <fb:comments xid="static1" numposts="10" width="425"></fb:comments> on a page without text filtering, but when viewing the page I get "The comments plugin requires an application id to properly namespace the provided xid." instead of the comment box.

Things like <fb:activity site="http://www.drupalforfacebook.org/"></fb:activity> work perfectly.

Could you please post a fb:comments on www.drupalforfacebook.org, so I can look at the html source generated and compare with mine?

Thanks a lot for your time, and for this great set of modules.

jason ruyle’s picture

We get the same error when we add the code to our node-*.tpl.php
It only happens in firefox.

marcus178’s picture

I am also only using

but getting the error, seen it a couple of time in chrome, as well as IE and firefox

nonoan’s picture

Title: fb:comments not working in firefox and IE » fb:comments not working
Version: 6.x-3.0-rc8 » 7.x-3.x-dev
Category: support » bug
Priority: Normal » Major
StatusFileSize
new1.76 KB

Hi. I think I've found the problem and maybe the solution, at least for my needs (7.x-3.x-dev).

The problem seems to be two sided:
1) Facebook needs appId in FB.init for fb:comments to work, and that is not being set properly.
2) In fb.js there is a second FB.XFBML.parse call that seems to break Facebook.

DISCLAIMER: to be honest… I haven’t programmed in the last few years and I'm new to Drupal, so the patch I've uploaded is just so someone who knows what is doing (I’m not) can have a look at it…
At least it fixes the problem in my site which uses fb:comments, with just the fb.module and the fb_app.module.

marcus178’s picture

I can confirm that this also seems to work in the Drupal 6 version, not come across any problems as yet. Thanks for the patch

Dave Cohen’s picture

nonoan, instead of that patch, enable fb_connect.module and make your application the "primary" app. That way, it will be initialized on all pages.

marcus178’s picture

I have fb_connect enabled and my app is the primary app, but this patch is the only thing that will make comments work.

Dave Cohen’s picture

Category: bug » support
Priority: Major » Normal

I don't consider that patch a real solution. If FB javascript is being initialized without an apikey, it would be better to determine exactly where and why that happens.

nonoan’s picture

Category: support » bug
Status: Active » Needs review
StatusFileSize
new2.38 KB

Hi Dave
Adding fb_connect (although needed) was not enough as it was not setting appId for fb_init_settings. Maybe FB changed something but it seems that apiKey it's not enough so you need appId (at least for fb:comments).

Here is a patch that replaces the other one. I think this patch might be a proper solution, although it needs your review...as I said before, I'm new to Drupal :-)

thanks a lot.

Marko B’s picture

Version: 7.x-3.x-dev » 6.x-3.0-rc8

Seems that FB has changed something. So far i had perfectly good working comments. with this code.

<fb:comments numposts="20" width="600" publish_feed="true"></fb:comments>

but now i get same error message. Also i used this on image gallery to have same comments for all images

<fb:comments xid="node-'.$node->nid.'"></fb:comments>';

but this also doesnt work anymore. Something has changed, this is in D6, but seems similar thing.

You can see it here, sometimes it works, sometimes i get error. I refresh page a few times and then comments appear. Strange?

http://www.izlasci.net/galerije/05-03-2011/maskirani-garcon-bar?slika=1

Anonymous’s picture

Error message is only on the first visit of a page. After refreshing once everything is fine.
Also, the error does also seem to not occur when a user is logged into the site.
Has someone tested the patch?

mannejkumar’s picture

i used contemplates to insert facebook comments.i installed contemplate module and in content types i selected one content type then selected edit template in that i entered .its working fine. now before posting those comments i want to enable admin permission. and how can i change latest comments to latest reviews? any help ?

Thanks
jagadeesh
www.eprlabs.com

mannejkumar’s picture

Version: 6.x-3.0-rc8 » 6.x-3.x-dev
Category: bug » support
Dave Cohen’s picture

Category: support » bug

mannejkumar, I don't know the answer but sounds not related to this thread. Please submit another issue.

Dave Cohen’s picture

Title: fb:comments not working » comments plugin requires an application id
Status: Needs review » Active

I can't reproduce this problem. I have an example page here: http://www.drupalforfacebook.org/node/2371 It uses regular modules/fb without any patches. It shows the markup used. Although at the moment when I enter a comment it displays a "database down" error, I suspect that is only a temporary problem on the facebook side.

It seems the cause of the original report was the extra <script> tag. I suspect everyone seeing the "The comments plugin requires an application id to properly namespace the provided xid" error is because of that same reason.

So can anyone tell me how to reproduce this?

derekwebb1’s picture

StatusFileSize
new88.4 KB

I can confirm that it happens even on the drupalforfacebook.com site:

I am using Ubuntu 10.04 and FFox 3.6.14

Marko B’s picture

yes, this is what i get too all the time and seems Dave gets it also but was unaware :-)

Dave Cohen’s picture

StatusFileSize
new42.17 KB

Interesting. It works for me every time.

Its worth noting that facebook's platform is not known for its reliability. ;)

Dave Cohen’s picture

I apologize, I missed that detail about working fine in some browsers but not others. I also see the problem in firefox. hmmm....

Dave Cohen’s picture

I've reported the problem to facebook, http://bugs.developers.facebook.net/show_bug.cgi?id=15794, where we can rest assured it will be ignored.

Dave Cohen’s picture

Status: Active » Needs review
StatusFileSize
new467 bytes

I think there has been confusion because of multiple causes of this problem. Here's a patch based on nonoan's earlier idea. Solved it for my quick test. I'd appreciate having that confirmed.

Marko B’s picture

What is/was the casue? some FB changes in api?

Dave Cohen’s picture

Status: Needs review » Needs work

Cause was a change in facebook api. All plugins work fine when you initialize JS with APIKEY, except this plugin which on some browsers apparently you must initialize with APP ID instead.

The above patch is not complete. I have some more changes pending which replace APIKEY with APP ID in several places.

Dave Cohen’s picture

Status: Needs work » Fixed

I didn't update this thread, but several changes to use the appId instead of apikey have been committed to the dev release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.