Facebook like box and Twitter profile widgets not showing on either the setup wizard or on blocks

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TomDude48’s picture

Status: Active » Postponed (maintainer needs more info)

Can you send me a link to the site?

sashkernel’s picture

FileSize
25.73 KB

I'm having problem with facebook like box. Only have a "preview" word displayed. That's all :(
See screenshot attached.

sashkernel’s picture

Just tried manually create a widget, but it does not display like box either :(. Is there some tutorial for dummies on how to configure it?

Regards,
Sash

TomDude48’s picture

Try refreshing. Some widgets are a little finicky and don't always display.

I can reproduce the issue on my side.

sashkernel’s picture

Nope. Did not do it. I even flushed all caches.

TomDude48’s picture

Check your browsers JavaScript console. Do you see a JavaScript error?

jimbo_cambridge’s picture

sub. I have the same issue, buttons work fine, facebook like box and twitter feed do not work. Previous twitter feed and facebook social blocks worked fine with other modules. 1 javascript error I can see on my machine is

Timestamp: 11/04/12 5:29:33 PM
Error: y.decay is not a function
Source File: http://widgets.twimg.com/j/2/widget.js
Line: 12

don't know if this is related, but only error I could find!

My site is on local server so cannot show you, but the block is created (css effects are rendered and firebug shows widget html) but there is no content displayed

Hope this helps.

Jimbo

sashkernel’s picture

My site is live and I have latest java installed.
www.scallagrims.com
Like Box is right under "Like" button on the right hand panel. It is in the code but no results.

Dadaisme’s picture

Version: 7.x-1.0-beta9 » 7.x-1.0-beta11

Hi!

Same here.

The Facebook like box do not appear in the widgets settings page, but is present in the blocks page. When the block is enable, I see the code in the page but nothing is rendered. I'm using the latest beta.

Error : Failed to load resource: the server responded with a status of 403 (Forbidden) http://connect.facebook.net/fr_US/all.js

Thx.

drupalnode’s picture

I am having a similar issue on my local development. I looked into the Facebook Development area (https://developers.facebook.com/docs/reference/plugins/like-box/) they are using the following connection string

(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'));

When the Drupal connection string is

js.src = "//connect.facebook.net/'.$loc.'/all.js#xfbml=1";

So I changed my socialmedia.widgets.inc connection string to the Facebook and now it is showing up in my configure options like (http://drupal.org/node/1378042) but when I place the block into a region there is no 'like box' there. It is also not showing up in the source for the region.

Any suggestions?

MacMladen’s picture

Priority: Normal » Critical
Status: Postponed (maintainer needs more info) » Active

I think I figured the problem and that is localization.

The author wanted to give options on languages but it is not the way it seems so, so it is flaw by design.

When I checked request I got en_RS which would mean 'English language in Serbia' which does not exist but reality is that we need English for other visitors so when we call for English that is for any user that picks US flag for English en_US and Serbian sr_RS for Serbian flag (or fr_FR for French for @Dadaisme) and not origin country and selected language.

So, maintainer have to either follow language and match country to have right all.js pulled or to stick with country and therefore with language too which would be wrong because English would not understand Facebook in Serbian.

The function in question is in socialmedia.widgets.inc and it is function socialmedia_widgets_facebook_js_sdk() { starting on line 507 with variable $loc that should be formed with different country reading.

fenstrat’s picture

Title: Facebook like box and Twitter profile widgets not showing » Facebook like box widget not showing due to localization (all.js 403 Forbidden)
Version: 7.x-1.0-beta11 » 7.x-1.x-dev
Component: User interface » Code
Priority: Critical » Major
Status: Active » Needs review
FileSize
2.21 KB

The problem is indeed localization.

Borrowing the approach fb_social module uses the attached patch checks the locale (based on site language and country, e.g. en_US) is valid with facebook's locales before using it and defaults to en_US if it is not valid.

Without this addition the module can use invalid locales (e.g. en_AU or en_RS) which causes facebook to return 403 (Forbidden) /* Not a valid locale. */. At which point fb's all.js is not included and the like box does not render.

Also, this module needs some serious TLC in regards to coding standards, but that's for another issue.

fenstrat’s picture

@drupalnode contacted me via email, much better to discuss here:

I used Cygwin to apply your patch and as far as I can see it was succesful however the blocks are not showing up. The like box is visible during the app configuration though.

Got any other ideas for this path?

To make sure the patch is working use firebug to monitor net requests, is the request going to http://connect.facebook.net/en_US/all.js#xfbml=1 or en_AU or some other local which is not valid?

Also make sure the facebook url you're requesting is valid.

askibinski’s picture

Status: Needs review » Needs work

After applying the patch in #12 the 403 js error is gone, but it is replaced by another one:

Unsafe JavaScript attempt to access frame with URL http://xxxxxxxxxx/content/caecus-tation-ulciscor-uxor#overlay=admin/structure/widgets/sets/edit/facebook-like-box from frame with URL http://static.ak.facebook.com/connect/xd_arbiter.php?version=9#channel=f27113a0f4&origin=http%3A%2F%2Fxxxxxxxxxxxxxxxxxxx&channel_path=%2Fdeel4%2Fadmin%2Fstructure%2Fwidgets%2Fsets%2Fedit%2Ffacebook-like-box%3Frender%3Doverlay%26fb_xd_fragment%23xd_sig%3Df3ed0bc9d%26. Domains, protocols and ports must match.

The box now renders with an error saying "There was an error fetching the like box for the specified page."

fenstrat’s picture

@askibinski Are you getting that error using https? Also it looks like your getting that error when rendered in the admin overlay, what happens when rendered in the front end theme?

Adel’s picture

Same problem here, patch on 12 return a php error, I tried twice but just in case, could you share the patched file please ?

fenstrat’s picture

Status: Needs work » Needs review
FileSize
51.91 KB

@Adel I've attached socialmedia.widgets.inc with the patch in #12 applied. However you should really be able to patch the file yourself, please see http://drupal.org/patch/apply

As there's been no reply from @askibinski I'm setting this back to needs review.

TomDude48’s picture

I applied fenstrat's patch. It is working for en_US, please test other locales.

Thanks for the patch fenstrat!

fenstrat’s picture

No worries @TomDude48 - I can verify it's working for en_AU which properly defaults back to en_US as en_AU is invalid. Anything else needed to get this committed?

fenstrat’s picture

Status: Needs review » Fixed

It appears #12 was committed in e72ef53.

TomDude48’s picture

Status: Fixed » Closed (fixed)
Adel’s picture

Patch worked, I had the same problem because of my javascript version: I am using a 64 bit windows and had Java for 32 bit, so when I checked for updates online, my Java machine was update but the trick is I should uninstall it and install the 64 bit version, now everything is fine.

fenstrat’s picture

@Adel The patch here in #17 is part of socialmedia 7.x-1.0-beta12. So there's no need to apply it, just use the latest version of the module.