FB Social Plugins 1.2: Open Graph and Language

Version 1.2 of my plugin is out! The changes are quite minor this time though and you won’t even see any new setting here. I have added some basic Open Graph tags that improve the way the likes appear on Facebook profiles. The other change is for non-English blogs: the plugins will now automatically display in the blog’s default language.

Until now, when clicking the Like button, the message posted only included a link based on the page’s title (what you see in your browser’s window title), something like “Bob likes FB Social Plugins 1.2: Open Graph and Locale – olussier.net“. By adding some Open Graph tags, both the article title and blog name are specified. From now on, when someone clicks the button, the message on their profile will look like this: “Bob likes FB Social Plugins 1.2: Open Graph and Locale on olussier.net“.

For those of you who have non-English blogs, you may have wished that the plugins were in the same language as your blog, since Facebook supports so many languages. With older versions, it wasn’t the case. If you are using XFBML, it was only in English, and if you are using iframes, it was according to the visitor’s language. Since you integrate the plugins in your blog, the newest version will match your blog’s default language, as long as it’s one of Facebook’s supported languages. Unfortunately, if your blog is multilingual this is not supported yet and only the default language will be used.

Bookmark and Share
Posted in WordPress by Olivier at May 14th, 2010.
Tags: , , , , , ,
  • http://topsy.com/trackback?utm_source=pingback&utm_campaign=L1&url=http://olussier.net/2010/05/14/fb-social-plugins-1-2-open-graph-and-language/ Tweets that mention FB Social Plugins 1.2: Open Graph and Language – olussier.net — Topsy.com

    [...] This post was mentioned on Twitter by Olivier Lussier. Olivier Lussier said: New post: FB Social Plugins 1.2: Open Graph and Language http://bit.ly/b6ft68 [...]

  • http://matchallenge.com Mathieu

    That looks much cooler on the profile page indeed.

    And good job addressing the language stuff already. It's more than most people can say about their work :)

    Keep up the good work!

  • http://sardoniclee.com/ steve L.

    hey there- i had version 1.1 working fine. just upgraded to 1.2 and now all of a sudden there's a big unwanted oversized box surrounding the FB Like Box in the sidebar widget that can't be controlled with the width/height settings. also had to move that widget to the bottom of the sidebar, since now (when it's at the top) it prevents any other widget from showing up at all. any ideas what changed here or what i can do? thanks a lot for your help…

  • http://olussier.net/ Olivier

    What a horrible bug of mine! Sorry about this and thanks for reporting it! Please upgrade to the latest 1.2.1 which fixes this. For your information, this bug occurs on widgets when using iframes mode.

  • RC

    HI Olivier
    Great plug in but for some reason I'm getting an error when I activate it. I only have two plugins installed on my wordpress. I've deactivated them and tried it again with no luck. I have the up to date wordpress. Any ideas what I should try to make this work? Below is my error
    Parse error: syntax error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /nfs/c04/h02/mnt/61670/domains/mydomain.com/html/wp-content/plugins/facebook-social-plugins/socialplugins.php on line 249

  • http://marienblogg.no Eivind M.

    Hi! Thanks again for a great plugin :) I use it on my WP MU 2.9.2 site. It works great on one of the sites there, but when I activate it on another one, the second blog outputs this just before the </body>-tag:

    <div id=”fb-root”></div>
    <script type=”text/javascript”>
    window.fbAsyncInit = function() { FB.init({appId: '115930585107249', status: true, cookie: true, xfbml: true}); };
    (function() {
    var e = document.createElement('script');
    e.type = 'text/javascript';
    e.src = document.location.protocol + '//connect.facebook.net/

    Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in /www/html/vhost/marienblogg.no/wp-content/plugins/facebook-social-plugins/socialplugins.php on line 256

    en_US/all.js';
    e.async = true;
    document.getElementById('fb-root').appendChild(e);
    }());
    </script>
    </div>
    As you can see, there is some sort of error occuring. The settings for the two blogs are identical both on WP and Facebook.

    Hope this helps you sort it out! :)

  • Gonzalo

    Hi Oliver Great Plugin! i find an issue when i tried to use it with the facebook share button, i do not if there is a bug or is just a problem i had. Thanks again for your amaizing work!

  • http://olussier.net/ Olivier

    Seems like I had yet another problem with PHP 4 compatibility. 1.2.2 fixes this for you

  • http://olussier.net/ Olivier

    Oops! Thanks for reporting this. 1.2.2 fixes it

  • http://olussier.net/ Olivier

    Could you please give more details about the issue? Do you use the share button through a WordPress plugin? If so, which one? And what kind of problem is there? Do you get an error message? Or are the plugins not appearing? Or not working…? Thanks!

  • Gonzalo

    Oh, yes! the problem seems to be with the javascript code of the facebook share button, your social plugin just stop working. Sorry for not be so clear Oliver my english is a bit poor

    Best Regards

  • http://marienblogg.no Eivind M.

    Great, it works, thanks! :)

  • http://marienblogg.no Eivind M.

    I'm also having the same issue. Looking forward to it being resolved ;) Thanks again for a great plugin!

  • http://marienblogg.no Eivind M.

    Hi again! I think I've maybe found another bug for you :)

    When I use the sidebar widget, it seems to show the like button for the last post presented in the loop. As you can see on my blog, http://marienblogg.no, the “site wide” like button in the sidebar shows 15 likes, as does the last article in the list (“Patriot gearbox NAS”). The same is the case on one of the other blogs in that install: http://helga.lerkelund.no/ (both blogs are in norwegian, but I assume you'll still spot the facebook plugins).

    I've also noticed that the sidebar like count also varies, so perhaps there's something wrong with some sort of cache system? I'm using WP MU 2.9.2 without any cache plugins.

  • RC

    Hi Oliver,
    Thank you. You last fixed stuff for me. Im going to attempt to do the widgets now but thanks again for listening to all of us.

  • http://olussier.net/ Olivier

    I just figured out why both can't work at the same time. It is well explained on this post: http://www.allfacebook.com/2010/04/one-problem-…. In short, the share button uses an older version of the Javascript SDK and you can't use both the older and the newest versions together. So when my plugin tries to load the newest, it fails with a javascript error.

    It seems Facebook meant for the Like button to replace the share button and not for them to be used together. The iframe version of the Like button doesn't use the Javascript SDK, so it will work with the share button. However, as the article explains, the XFBML version of the Like button implements the sharing part too, so it actually does all that the share button does and more. That's probably why Facebook made it so the Like button has to replace the Share button.
    So, if you really want to keep the Share button, switch to iframe mode for the Like button (remove your application ID in the settings). Otherwise, disable your Share button and have the Like button replace it. If I find a workaround to this problem that would make both work together well, I'll let you know!

  • http://olussier.net/ Olivier

    You are totally right! I'm adding this to the todo list for version 1.2.3!

  • http://walkingthinice.com kathy

    Hello, I'm trying to get the facebook comments part of your new plugin to work on my WordPress blog. I have an application id – have no idea where to set it or how to activate the comments.php module. Can you help?

  • http://olussier.net/ Olivier

    First, where to enter the application ID: in your dashboard, look in the menu on the left for “FB Social Plugins” under Settings. On that page, you have a field at the top to enter the ID. Enter it and click “Save changes”. Then, in the left menu, look for “Widgets” under “Appearance”. On that page, you will see the “FB Comments” widget which you can add to your sidebar. Don't forget to set the correct width (in pixels).

  • Gonzalo

    thanks for the information Oliver! but it is not so good because i find that the facebook like button do not take in consideration the urls like “gallery/?id=13″, it just take “gallery/” as the real one. do you know something about it?

    Best Regards. .

  • http://olussier.net/ Olivier

    Gonzalo, would you happen to have an example of this? The URL used is the post's permalink which is usually the way to uniquely identify a post.

  • Gonzalo

    Yes, i have resolved my problem. Your plugin use the permalink to sent the url to facebook and create the headers is not it?. The problem appear when someone want to extend the wordpress pages or use another plugin like fotobook, that create a custom url when display photos. So i do not know if it is a bug or just a personal issue but i wanted to let you know just in case. Thanks for everything.

    Best Regards.

  • http://activ8social.com dcSportsGuy

    Olivier,

    Would it be possible for you to provide the php code for manual insertion of your plugin so that I can add it to my index, single, page and/or archive PHP files directly?

    Thanks!

  • Jim

    anyone having a problem getting this to render in IE 8? In FF and Chrome everything's fine, but in IE you end up with an <fb:like> tag, unrendered.

  • http://olussier.net/ Olivier

    The plugin gives you a good amount of freedom as to where you want to insert the plugins. It is meant to be used by WordPress as a plugin and not really to be called directly. If you need a more custom solution, you may want to consider using the code from Facebook directly, which you can generate here: http://developers.facebook.com/plugins

  • http://olussier.net/ Olivier

    IE8 works fine for me wherever I've tried it. Maybe something else on your page is interfering with the Facebook code. Do you have an URL to show us where it doesn't work for IE8? It could help…

  • Andrew

    Great plugin Oliver. Would prefer the Comments to show under WordPress posts rather than just the sidebar. Maybe in the next version please?

  • Sanitys

    Wondering if you can help me out, http://www.tekgoblin.com I integrated this plugin to my site. First of all, I do not know how to get an API ID, I tried and I couldnt. Second, when you press “Like” it asks you to login, and after you do it just goes to a blank page. Can you please check this out. Or email me at sanity@tekgoblin.com

  • stormcape

    Hi, the comment plugin does not seem to want to work, I did put in the API key and there seems very little else to do, but if I edit the plugin

    facebook-social-plugins/socialplugins.php (inactive)

    it says inactive. I see no way to activate this.

    The plugin is messing with my comments, I now have two comment boxes in stead of one, but one of these is inactive!

    Am I missing some instructions or documentation?

  • MD

    Hi Olivier, and thanks for the latest updates.

    My blog is in french with the Tiga theme but i cannot seem to have the FB “like” button in french. I modified the theme header to include the lang=”fr” attribute to the html tag, as well as a meta http-equiv=”content-language” content=”fr” but to no avail so far : the “recommend” button remains in english…

    What am I doing wrong ? My site is running PHP4 in case that matters…

    Thanks !

  • http://olussier.net/ Olivier

    First, to get an application ID, go to http://developers.facebook.com/setup/ and enter your site's name and URL. Then click on “Create application” and the next page will give you the ID, which you need to enter on the plugin's settings page.

    Now regarding the blank page, I tried it on your site but couldn't reproduce the problem. It asks to login in a popup window only if you aren't already logged to Facebook and once you log in the popup window closes and the Like button changes to show that you have now liked the article… If you have any more specific details regarding how it can be reproduced, let me know. Maybe switching the XFBML by adding an app ID will fix this for you.

  • http://olussier.net/ Olivier

    You say you entered the “api key” (do you mean the application id?), so you can see the “FB Social Plugins” settings page from the menu on the left? If the plugin is not activated, it shouldn't appear in the menu. If it appears, then it's activated and I wonder why it says “inactive”… First make sure it is activated. Click on “Plugins” in the left menu and find the plugin and, if there is an “Activate” link below, click it.

    The plugin should not mess with comments, it doesn't add any comment box at the end of articles. Without actually seeing it, I can't tell what's going on… maybe another plugin is doing it, or maybe the plugin is interfering with another one in some way… That would depend on what plugins you are using. Would you have an URL for me to check?

  • http://olussier.net/ Olivier

    My first guess is that even though your content is in French, your WordPress still has the default configuration which is English. This is the case unless you have installed a French version of WordPress or you have changed this configuration yourself. Open your config.php file (the one where you entered your database configs) and find a line that looks like this:

    define ('WPLANG', '');

    and set it to:

    define ('WPLANG', 'fr_FR');
    or
    define ('WPLANG', 'fr_CA');

    depending if you're from France or Canada. Then all the social plugins on your site should appear in French.

    If the config was already set to French, then please give me your blog URL so I can check it out and see what could be wrong.

  • Sanitys

    Well when I go to the facebook developer site and I enter Name: TekGoblin URL: http://www.tekgoblin.com for the URL it says invalid URL. What am I supposed to enter?

  • http://olussier.net/ Olivier

    Weird, but it seems you have to add a / at the end of the URL or else Facebook doesn't like it. So try entering http://www.tekgoblin.com/ instead of http://www.tekgoblin.com and it should work.

  • MD

    Nope, my wordpress installation is in french (i used the official french version of wordpress). I just checked my wp-config.php and it has define ('WPLANG', 'fr_FR'); as it's supposed to.

    My blog URL is http:///www.mines-douai.fr/admi-douai

  • Dave H

    Im getting the error when someone clicks on he LIKE button in a wordpress acticle that the page can not be found. what is causing this??

  • Dave Hauss

    BTW – my WEB SITE is http://www.unlimitedsounds.com/blog

  • http://olussier.net/ Olivier

    I just tried it and it works fine for me. When logged, it likes the post and when not logged, it pops up the Facebook login page. Do you have more information you could give to help reproduce your problem?

  • Dave H

    When I go to my site http://www.unlimitedsounds.com.blog and go to one of the posts and click on LIKE, it shows that I like it but then says ERROR.. for instance.. I click on one of the LIKE BUTTONS for a post called MAY 29, 2010.. I get the thing that says I like it “YOU LIKE THIS” BUT THEN it says ERROR. I click on ERROR and it opens up a new window from facebook and says “The page at http://unlimitedsounds.com/blog/2010/05/31/may-… could not be reached.”

    Any ideas??

  • http://olussier.net/ Olivier

    Ok, it seems this is a problem on Facebook's side with all new Like buttons added today. It's discussed here: http://forum.developers.facebook.com/viewtopic…. and here's the bug report: http://bugs.developers.facebook.com/show_bug.cg…
    Unfortunately it seems all we can do is wait for Facebook to fix this…

  • Dave H

    OK thanks I hope this gets resolved by FACEBOOK SOON!

  • MD

    I think i found the bug why the facebook likes always appear in english on my french blog. It's in the socialplugins.php, function GetLanguage().
    The line “if (strlen($langCode) >= 2) {“
    should be “if (strlen($wpLang) >= 2) {” since, at this point, $langCode is uninitialized.

    Tested on my blog, works ok now.

  • http://olussier.net/ Olivier

    You're totally right! Thanks! I'll fix this in next release.

  • http://julians.name jinfinite8

    Great plugin, thanks for making it!

    I notice that when I plugin my facebook application ID none of the functions work. When I leave it off, things seem to be fine. Site is http://www.localna8ion.com where I currently have the application ID blank.

    Question: I've noticed on your site (and a couple of others recently) that when you click on the like button there's a way for the person to ALSO add a comment. Is that custom code? Is there a way to implement that with your plugin?

    Thanks so much!

    -Julian

  • http://olussier.net/ Olivier

    When the application ID is entered, it uses the FBML version of the plugins. Those are loaded with some javascript when the pages load. There is probably something interfering that makes that code fail. There is a known issue when the Facebook share button is used, but this is not the case for you. I think it may be the code for Facebook Insights that interferes because it creates a global “FB” object. I don't really know much about Insights, but you may try deactivating it just to see if it's really what is interfering. If so, maybe there is updated code you can use that will work with social plugins… or else, look for a javascript error that could help finding out what's wrong.

    The feature that allows adding a comment from the like button works only with the FBML version, so if you can fix the above problem, you'll have that too! :)

    Let me know if I can help more.

  • http://julians.name jinfinite8

    That's really helpful Olivier and I appreciate the lead you gave me on trying to solve the issue! Thanks.

  • Adrian

    Hi Olivier
    Not sure this is the right place to post this but …..
    I am really pleased with your plugin and have installed it on my wordpress blog and that of my partners. We are both very new to blogging so this might be a stupid question.

    How can we alter the colours of the heading and stream text?
    Which css file controls this?
    Perhaps you could direct me to page that tackles this problem.

    Many thanks and thank you again
    Adrian

  • http://olussier.net/ Olivier

    Unfortunately, you can't use custom colors since the plugins are actually loading on Facebook's site in an iframe (even when using XFBML, an iframe is generated). The only thing you can choose is the color scheme and there are currently only “light” and “dark”. Maybe Facebook will add more options in the future…

  • Nikcoultas

    Hi Olivier

    I think I might have finally found a plugin that works with my theme :)

    Couple of questions ….

    1. Is it possible to have the Like and Comment button at the end of the post so that i can use this instead of the wordpress comments feature ?
    2. Is there anyway to count the number of likes on a daily / weekly / monthly basis and report this in a widget ? I really want to replace my ratings widget with this but cant seem to figure out if it can do this last bit.

    Thanks

    Nik

  • http://olussier.net/ Olivier

    1. This is not possible with my plugin for now, though I do plan to implement this in a future version.
    2. This plugin doesn't do any kind of stats. There may be a way to do this using Facebook's API but I don't know about it. If it's doable, there is probably a plugin that does it! ;)

  • http://www.facebook.com/mano2 Laszlo Olah

    Any possibilities for the ő,ű,ú,ó and same letters? :)

  • http://olussier.net/ Olivier

    Not sure what you mean… what's wrong with those letters?

  • http://www.facebook.com/mano2 Laszlo Olah

    I have a blog where I installed the plugin and the letters that I mentioned above are looking strange. For exapmle letter 'ö' is look like this: 'ö'. I'm trying to fiugre out that is this a problem with the wordpress theme or with the plugin?

  • drey

    i tried to use the facebook comments box (got an appID) and it works on every page of my template but not within the single.php (where i actually need the comments box).

    any ideas what the problem could be?

  • Blksnshn

    When posting a comment after hitting the like button, the posting on Facebook is accompanied with the wordpress logo. How do I change this so that my logo/icon is the image next to the posting?

  • http://olussier.net/ Olivier

    The default should be the first image in the post or no image at all if the post doesn’t have any. What is your blog’s address? I’ll check it out.

  • http://www.facebook.com/manish.kataria Manish Kataria

    Thanks for the wonderful plugin, kindly guide me on how can I add facebook comments box after my all posts & articles.

  • Abhidixit

    aaaaaaaaaaaaaaaaaaaaa

  • http://olussier.net/ Olivier

    Unfortunately it can’t be done with this plugin at this time. Other plugins do it so I suggest you use one of them.

  • http://www.copious-systems.com/questions/4cf60f1d1a8efc0664000151/ RealTime – Questions: “So how do i remove the recent activity on FB, ‘ NOW ‘ ?”

    [...] [...]

  • http://www.theirmasterssound.com Maurice

    Great plugin, working almost perfectly. I have only one little issue. Even after specifying that I only want a like button on the bottom of posts, the plugin displays a like button on the bottom of one particular widget (subscribe2). Any idea how to prevent that? Thanks!

blog comments powered by Disqus