Conflict with JFBConnect


  • Your avatar
    north40soap    
     5 months ago
    0

    Recently I purchased JFB Connect for my site so that customers can login via social media profiles.  I noticed that the application as not working perfectly, so I contacted JFB Connect for support.  They have indicated that the most likely conflict is with AWO Rewards, and they have suggested I contact you for possible support.  


    What they have deciphered is:


    "The problem is that you're page is loading the very old Facebook Javascript library, and that's causing a conflict with the newer Facebook Javascript library and the login process. You'll need to remove the following code from the page HTML:"

    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&appId="; 
                fjs.parentNode.insertBefore(js, fjs); 
            } (document, "script", "facebook-jssdk")); 
            window.fbAsyncInit = function () { 
                FB.init({ 
                    appId: "", 
                    status: true, // Check login status. 
                    cookie: true, // Enable cookies to allow the server to access the session. 
                    xfbml: true  // Parse XFBML. 
                }); 
                FB.Event.subscribe("edge.create", function (response,elem) { 
                    widget_id = elem.id; 
                    if(widget_id!=undefined) { 
                        item_id = widget_id.substr(15); 
                        document.getElementById("fb_like_"+item_id).innerHTML = "<img src='/media/com_aworewards/images/loading.gif' />"; 
                        document.getElementById("frm"+item_id).submit(); 
                    } 
                    //alert("You liked the URL: " + response); 
                }); 
            }
    They have also pointed me toward the following articles to justify their opinion.For more details, see: 
    Facebook's quickstart guide which specifically calls out the sdk.js file: 
    https://developers.facebook.com/docs/ja … quickstart 

    Another guide from Facebook specifically saying not to use all.js: 
    https://developers.facebook.com/docs/ja … /angularjs 

    And, of course, the obligatory Stack Overflow post: 
    http://stackoverflow.com/questions/3846 … and-sdk-js 
    My questions to you are....1) What would be the challenge with removing that code from the AWO Rewards file? 


  • Your avatar
    seyi    
     5 months ago
    0

    Hello,

    In the code above, which is in 2 files:
    www/plugins/aworewards/facebook/tmpl/component_facebook_like.php
    www/plugins/aworewards/facebook/tmpl/module_facebook_like_default.php

    Please change these:

    Change
                js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId='.$this->params->get('social_facebook_key').'";


    to
                js.src = "//connect.facebook.net/en_US/sdk.js";


    And after this:
                FB.init({
                    appId: "'.$this->params->get('social_facebook_key').'",
                    status: true, // Check login status.
                    cookie: true, // Enable cookies to allow the server to access the session.
                    xfbml: true  // Parse XFBML.


    Add this
                    ,version: "v2.8"


    That should fix the issue.