1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.5 Disabling facebook's sdk.js for logged in users

Discussion in 'XenForo Questions and Support' started by thumped, Jun 22, 2016.

  1. thumped

    thumped Well-Known Member

    In a situation where facebook registration and login is allowed, Facebook's sdk,js needs to be loaded so that unregistered / logged out users can register and log in using their facebook credentials. But is there any reason why the Facebook sdk.js call can't then be disabled once the user is logged in?

    (I can only think of two reasons: the default xF social sharing buttons require it, but I'm using @wmtech Social Share Privacy instead so it doesn't need to be loaded. @xfrocks ' [BD] Social Share addon uses it too, for auto posting new threads to facebook - but I can use RSS feeds + IFTTT triggers to do that instead.)
     
  2. Mike

    Mike XenForo Developer Staff Member

    The default buttons do use the SDK to render the share output.
     
  3. thumped

    thumped Well-Known Member

    yeah... but if you're not using the default buttons?
     
  4. Mike

    Mike XenForo Developer Staff Member

    I can't easily comment on what would happen as it depends on what the add-on does. I can see that the Facebook SDK initialization is being forced in the HTML source though, so it's being triggered by something on the server side.
     
  5. thumped

    thumped Well-Known Member

    sorry - i'm probably not being clear here so i'll rephrase it a bit & maybe explain where i'm coming from. So..

    If i modify the code that invokes sdk.js from facebook's servers in page_container_js_body so that it only loads if a user is unregistered, will it break anything in unexpected and/or interesting ways? I'm talking about this bit
    Code:
    // Facebook Javascript SDK
    XenForo.Facebook.appId = "{xen:jsescape $xenOptions.facebookAppId}";
    XenForo.Facebook.forceInit = {xen:if $facebookSdk, true, false};
    Basically i want to allow FB registrations & logins, but I don't want it loading for every logged in user on every page load, because of tinfoil hat privacy concerns and some miniscule efficiency gains. But mostly because it's just bugging me.
     
  6. Mike

    Mike XenForo Developer Staff Member

    This is how it works by default. I was referring to the output from the XenForo.Facebook.forceInit on your site. It's showing as "true" on every page that I looked at. I was testing as a guest, but the default system only forces it with sharing blocks, rather than anything specific to guests. This makes me think it's an add-on that's involved.
     
  7. thumped

    thumped Well-Known Member

    perfect, thanks
     

Share This Page