您的位置:首页 > 其它

ZenCart 使用Facebook账号登陆

2013-06-26 08:47 274 查看
首先打开http://www.facebook.com/developers/apps.php 注册网站的apps,注册成功以后记住"appId" 和"secret", 这在后面需要用到.

首先到这里下载zencart 的facebook插件:

下面是详细的安装步骤:

1.备份"includes/modules/pages/login/header_php.php", "includes/modules/pages/logoff/header_php.php", 这两个文件需要覆盖到之前系统的,所以建议安装插件之前最好先备份.

2.导入SQL文件"install_sql.sql".

3.上传所有文件到服务器中.

4.编辑登录模板页面"tpl_login_default.php",添加下面代码在页面空白中

<div id="fb-root"></div>

<script>

window.fbAsyncInit = function() {

FB.init({

appId : ‘<?php echo $facebook->getAppId(); ?>’,

session : <?php echo json_encode($session); ?>, // don’t refetch the session when PHP already has it

status : true, // check login status

cookie : true, // enable cookies to allow the server to access the session

xfbml : true // parse XFBML

});

// whenever the user logs in, we refresh the page

FB.Event.subscribe(‘auth.login’, function() {

window.location = "<?php echo zen_href_link(‘facebook’, ", ‘SSL’); ?>"

});

};

(function() {

var e = document.createElement_x(‘script’);

e.src = document.location.protocol + ‘//connect.facebook.net/en_US/all.js’;

e.async = true;

document.getElementByIdx_x(‘fb-root’).appendChild(e);

}());

</script>

<div>Have a Facebook account? <fb:login-button perms="email"></fb:login-button></div>

5.最后编辑"includes/extra_configures/facebook-config.php" , 替换 "appId" 和 "secret" 字段.

所有步骤完成以后,打开登录Sexy Shoes页面譬如http://www.batterylaptops.co.uk/index.php?main_page=login 即可以看到facebook的登录按钮.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: