Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

What we can do for facebook connect either user logged in or not in facebook?

 

=> Just put the following jquery code in your file in which You want to use it :

 

 

$(document).ready(function() {

FB.init({appId: 'your appId', status: false, cookie: true, xfbml: true, oauth: true});

(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 = document.location.protocol+"//connect.facebook.net/en_US/all.js#xfbml=1&appId=your appId ";

fjs.parentNode.insertBefore(js, fjs);

}(document, 'script', 'facebook-jssdk'));

 

FB.getLoginStatus(function(response) {

if (!response.session) {

FB.init({appId: 'your appId', status: false, cookie: true, xfbml: true, oauth: true});

setEvents();

}

});

 

});

 

 

function setEvents() {

FB.Event.subscribe('auth.authResponseChange', function(response) {

// do something with response

if(response.status==='connected') {

var newsletterval = 0;

if(document.getElementById('newsletter') && document.getElementById('newsletter').checked) {

newsletterval = 1;

}

 

var RAccessToken = response.authResponse.accessToken;

var RExpiresIn = response.authResponse.expiresIn;

window.location.href = "<?php echo $FaceBookLoginURL; ?>?newsletter="+newsletterval;

 

}

});

}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...