Skip to content

Instantly share code, notes, and snippets.

@stefanbc
Created May 13, 2014 11:26

Revisions

  1. stefanbc created this gist May 13, 2014.
    26 changes: 26 additions & 0 deletions header.tpl
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    <!-- Requires dependencies https://github.com/carhartl/jquery-cookie -->
    <script src="{$js_dir}jquery.cookie.js"></script>
    {if $smarty.get.fb == 1 && $page_name == 'index'}
    <script type="text/javascript">
    $(document).ready(function(){
    // console.log("BEFORE");
    var cookie = $.cookie("loggedinFB");
    // console.log("Cookie: " + cookie);
    if (cookie != 'logged') {
    // console.log("AFTER");
    $.cookie("loggedinFB", 'logged');
    window.location.href = 'https://%YOUR_LOGINRADIUS_URL%/requesthandlor.aspx?apikey=%YOUR_API_KEY%&provider=facebook&callback={$base_uri}?fb=1';
    } else {
    window.location.href = 'https://apps.facebook.com/%YOUR_FACEBOOK_APP%';
    }
    });
    </script>
    {/if}