0

我一直在寻找更改登录的默认按钮,我知道对此有几个问题,但我无法做到这一点。我已经尝试了几个帖子。

这是有效的代码按钮,这是原始 btn

<a href="javascript:void(0);"> <fb:login-button size="large" scope='email,user_birthday'  onlogin="fb_login()"><?php echo $this->get_variable('login');?></fb:login-button></a>

这是我试图设置按钮的方式

<a href="javascript:void(0);" onclick="fb_login();"><img src="images/loginfacebook.png" class="loginfbfb" ></a>

这是JS代码。

<script>  

    window.fbAsyncInit = function() {
        FB.init({
          appId      : <?php echo $facebook->getAppID() ?>,
          status     : false,
          cookie     : true,
          xfbml      : true
         });
        };

        (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));

        function fb_login() {

            FB.getLoginStatus(function(response) {
                  if (response.status === 'connected') {
                    // the user is logged in and has authenticated your
                    // app, and response.authResponse supplies
                    // the user's ID, a valid access token, a signed
                    // request, and the time the access token 
                    // and signed request each expire
                    var uid = response.authResponse.userID;
                    var accessToken = response.authResponse.accessToken;

                    Set_Cookie( '<?php echo COOKIE_FBLOGINSUCCESS;?>', 1, 0 , "/"+'<?php echo $srv_pats;?>','<?php echo $srv_nms;?>') ;
                    
                   // location.href = "<?php echo BASE?>index.php?fb=fb";
                    window.location.reload();
                    
                  } else if (response.status === 'not_authorized') {
                    // the user is logged in to Facebook, 
                    // but has not authenticated your app
                  } else {
                    // the user isn't logged in to Facebook.
                  }
                 });
        }
    </script>
4

0 回答 0