Search code examples
phpfacebookdrupaldrupal-6fbconnect

FBConnect: Why is it showing on some pages and not others?


In the top right hand corner, it shows on this page:

http://www.thegreekmerchant.com/product/fokofpolisiekar/band-logo

But not on this one

http://www.thegreekmerchant.com/

Any idea why? I'm using Drupal 6 with the FBConnect module.


Solution

  • In fact, the problem is that the pages use different scripts to load the FBConnect module.

    On http://www.thegreekmerchant.com/:

    <div id="fb-root"></div>
      <script type="text/javascript">
        window.fbAsyncInit = function() {
          FB.init({
            appId  : '146943825373452',
            status : true, // check login status
            cookie : true, // enable cookies to allow the server to access the session
            xfbml  : true,
            logging: '0'
          });
    
          jQuery(document).trigger('fb:init');
        };
    
        (function() {
          var e = document.createElement('script');
          e.src = document.location.protocol + '//connect.facebook.net//all.js';
          e.async = true;
          document.getElementById('fb-root').appendChild(e);
        }());
      </script>
    

    On http://www.thegreekmerchant.com/product/fokofpolisiekar/band-logo there are two scripts, the previous one and the following one:

    <div id="fb-root"></div><script type="text/javascript">
     window.fbAsyncInit = function() {
       FB.init({
         appId: "146943825373452",
         status: true, 
         cookie: true,
         xfbml: true
       });
    
       FB.Event.subscribe("edge.create", function(href, widget) {
          _gaq.push(["_trackEvent", "Facebook like", "Drupal", href]);
       });
    
    
     };
     (function() {
       var e = document.createElement('script'); 
       e.async = true;
       e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
       document.getElementById('fb-root').appendChild(e);
     }());
    </script>
    

    I've replaced the first script with the second one and http://www.thegreekmerchant.com/ now works (of course not the sharp version, but on my sandbox server). You only need the second script on http://www.thegreekmerchant.com/product/fokofpolisiekar/band-logo.