dtgr3392 2012-08-22 09:05
浏览 88

Facebook登录wordpress没有插件

I'm providing a custom login page for the website visitors and would like to include the Login with Facebook button such that the application checks if the user email is registered, and if so it will log the user in.

using wp_signon I can log a user in by providing the email and password, but in that case I don't have a password for the user, so is there a way I can provide a Facebook login button without using plugins?

  • 写回答

2条回答 默认 最新

  • doume1301 2012-08-31 10:34
    关注

    Use this code and replace the APP ID with and your Domain...

    <html>
        <head>
          <title>Login with Facebook</title>
        </head>
        <body>
    
          <div id="fb-root"></div>
          <script>
            window.fbAsyncInit = function() {
              FB.init({
            appId      : 'YOUR_APP_ID', // App ID
            channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
            status     : true, // check login status
            cookie     : true, // enable cookies to allow the server to access the session
            xfbml      : true  // parse XFBML
          });
        };
        // Load the SDK Asynchronously
        (function(d){
           var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
           if (d.getElementById(id)) {return;}
           js = d.createElement('script'); js.id = id; js.async = true;
           js.src = "//connect.facebook.net/en_US/all.js";
           ref.parentNode.insertBefore(js, ref);
         }(document));
      </script>
    
      <div class="fb-login-button">Login with Facebook</div>
    
    </body>
    

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度