• [MOD] Facebook Connector V1.0 & V2.0 5 0 5 1
Currently:  

Author Topic: [MOD] Facebook Connector V1.0 & V2.0  (Read 263277 times)

0 Members and 3 Guests are viewing this topic.

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Facebook Connector V1.0 & V2.0
« Reply #180 on: June 06, 2012, 05:41:14 PM »
Da mir das ganze zuviel Englisch ist, meine Frage, werden bei Facebook auch Bilder angezeigt ?
Habe es auf meiner Testseite eingbaut, klappt auch, bis auf Bilder.
Kann ja sein das der Mod so richtig ist, das keine Bilder angezeigt werden, wenn doch dann schiebt mich bitte mal zu der Stelle die ich überprüfen sollte.

LG Harald
I think I understand your question using google translate...
My mods do not send the actual big pictures to facebook yet (still working on that one)
This mod just allows you to log into your site using your facebook account.
My other mod (the like/send/share button) does post a thumbnail of the picture along with the descriptions in your newsfeed on facebook.
It can be touchy sometimes. If you post it incorrectly the first time like when testing and something is not setup correctly, facebook caches it on their end and then the thumbnail never shows up till the cache expires (I think 24hrs)

let me know if your question is something different,
Buddy Duke
www.budduke.com

Offline zhono

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
Re: [MOD] Facebook Connector V1.0 & V2.0
« Reply #181 on: January 12, 2013, 09:39:54 PM »
I have a few problems with this great mod. I'll try to explain them well.

If a user already has an account on my site with the same email as his Facebook, if he clicks the Login with Facebook button, it links his account nicely, and he can now use Facebook to login and out.

But if he is a new user to my site, and wants to register with Facebook, there is trouble. Using an extra Facebook account, I tested it and this is what happens.

Completely logged out from my site. Logged into Facebook.com with my extra account. Go to my site, click Register, I get the standard registration page, no Facebook. Is that supposed to happen?

I instead, I click on the Login with Facebook button. The popup comes, asks for permission. I Agree and it says all good. But now, the user has to click on "Registration" again, where he has to agree to terms, enter username, password, and email. Shouldn't it all be one step/page? How does the user know to go find the "Registration" link after he already thinks he registered with Facebook in the popup?

After you fill out that registration form, and are registered on the site using Facebook info, it still only shows you the "Registration" link, and shows you as logged out. But even though it thinks you are logged out, it doesn't give you the login form. During all this, the Facebook button itself thinks you are logged in, but the rest of the site doesn't.

And the last problem is login/logout. If I logout from facebook, either on my site, or on facebook.com, I will automatically be logged out from both. So that works.
But, if I login on Facebook.com and then go to my site, it says I'm not logged in, but if I just refresh the page, it shows my all logged in. Is there a way to detect that, and make it refresh or something, so that a user does not try to login when he doesn't have to?


In case I messed up my user_loginform and user_logininfo, I'll include them here. I was using custom login and info forms, but it was too much trouble to edit, so I went back to the standard ones.

user_loginform.html
Code: [Select]
<table width="100%" height="100%" border="0" cellpadding="3" cellspacing="0">
  <tr>
    <td valign="top" align="left">
    {ifnot fb_hide1}
      <form action="{url_login}" method="post">
        {lang_user_name}<br />
        <input type="text" size="10" name="user_name" class="logininput" />
        <br />
        {lang_password}<br />
        <input type="password" size="10" name="user_password" class="logininput" />
        <br />
        <table border="0" cellspacing="0" cellpadding="0">
          <tr valign="top">
            <td><input type="checkbox" name="auto_login" value="1" /></td>
            <td><span class="smalltext">{lang_auto_login}</span></td>
          </tr>
        </table>
        <br />
<input type="submit" value="{lang_login}" class="button" />
      </form>
      » <a href="{url_lost_password}">{lang_lost_password}</a><br />
      {endifnot fb_hide1}
     {ifnot fb_hide2}
 » <a href="{url_register}">{lang_register}</a><br>&nbsp;</td>
 {endifnot fb_hide2}
     {if fb_hide2}
     {fb_message}
     {endif fb_hide2}
 
  </tr>
  <tr><td valign="top" align="center">
  {if fb_loggedin}
   <table width="100%" border="0"><tr><td align="right">
   <fb:profile-pic uid='loggedinuser' facebook-logo='false'></fb:profile-pic></td><td valign="center" align="left"> Welcome,<BR> <fb:name uid='loggedinuser' useyou='false'></fb:name>
   </td></tr></table>
{endif fb_loggedin}
      <fb:login-button size="small" length="long" autologoutlink="true" scope="email,user_website,publish_stream" ></fb:login-button>
    </td></tr>
</table>

user_logininfo.html
Code: [Select]
<table width="100%" height="100%" border="0" cellpadding="4" cellspacing="0">
  <tr>
    <td valign="top" align="left">
 {lang_loggedin_msg}<br />
      &raquo; <a href="{url_lightbox}">{lang_lightbox}</a><br />
      {if support_ticket_activ}
 &raquo; {url_support_ticket}<br />
 &raquo; <a href="{url_support_ticket_new}">{lang_support_new}</a><br />
 {endif support_ticket_activ}
 &raquo; <a href="{url_control_panel}">{lang_control_panel}</a><br />
 {ifnot fb_loggedin}
      &raquo; <a href="{url_logout}">{lang_logout}</a><br/>
      {endifnot fb_loggedin}
      <br /><b class="h2">{cp_link}</b>
</td>
  </tr>
  <tr><td valign="top" align="center">
{if fb_loggedin}
   <table width="100%" border="0"><tr><td align="right">
   <img src="{fb_pic_small}"></img></td><td valign="center" align="left"> Welcome,<BR> <a href="http://www.facebook.com/profile.php?id={fb_userid}">{fb_name}</a>
   </td></tr></table>
{endif fb_loggedin}
      <fb:login-button size="small" length="long" autologoutlink="true" scope="email,user_website,publish_stream" ></fb:login-button>
    </td></tr>
</table>

Thanks for any help you can provide for this great mod. It's appreciated.

*EDIT* Also, my site, if you want to have a look there. http://anime-themes.com Excuse the messy category list. I'm still finishing it up a bit.

*EDIT 2* When that new user tries to register with Facebook, but it doesn't show him as logged in, he can logout from Facebook completely, and login again, and he will be logged into the site.

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Facebook Connector V1.0 & V2.0
« Reply #182 on: January 13, 2013, 05:07:58 PM »
@zhono,
The description you gave seems to be correct, I think the problem you may be running into is the dropdown javascript for the login you have running.
If you test it at my site http://www.budduke.com The normal procedure after they login/create an account with facebook on your site it should refresh the login box which seems to not be happening at your site.
I could not register at your site because it was disabled when I got to the password screen.
You may try changing to a default 4images template temporarly to determine if it is working correctly or not.
The login goes by page refresh because it lies in the hearder area of the page.

I am planning on working on this mod again becasue facebook keeps changing how things work but not ETA on it.
Buddy Duke
www.budduke.com

Offline zhono

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
Re: [MOD] Facebook Connector V1.0 & V2.0
« Reply #183 on: January 13, 2013, 08:58:37 PM »
Okay, I did some more testing. As you suggested, I used the normal template. I used a fresh copy of the default template from 1.7.11, and did the mods to header, register_form, user_loginform, and user_logininfo. All of the same problems exist. New user is not redirected to the registration page. Once he goes there himself and registers, he is still not logged in to the site(even though it says Facebook is logged in), and he sees no login form.

Users which already have a site account and just want to link Facebook, they can login, but there is also no redirect there either. They have to refresh.

Logout with Facebook button does refresh the page and logout as it should.

I'm going to look at fbmain.php and see what I can do. But it's your script, so you would know better than me how it works. Thanks for your help. Hopefully we can get it working. I'm already using your "Like" mod, and I've replaced the 4images comments with Facebook comments, so having the Facebook login makes sense.

*EDIT* Also, registration is not actually disabled. I'm using a mod that forces the user to enter all details in the proper format before he can click the register button. Seems to work fine when creating the account with Facebook.

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Facebook Connector V1.0 & V2.0
« Reply #184 on: January 13, 2013, 10:33:40 PM »
Okay, I did some more testing. As you suggested, I used the normal template. I used a fresh copy of the default template from 1.7.11, and did the mods to header, register_form, user_loginform, and user_logininfo. All of the same problems exist. New user is not redirected to the registration page. Once he goes there himself and registers, he is still not logged in to the site(even though it says Facebook is logged in), and he sees no login form.

Users which already have a site account and just want to link Facebook, they can login, but there is also no redirect there either. They have to refresh.

Logout with Facebook button does refresh the page and logout as it should.

I'm going to look at fbmain.php and see what I can do. But it's your script, so you would know better than me how it works. Thanks for your help. Hopefully we can get it working. I'm already using your "Like" mod, and I've replaced the 4images comments with Facebook comments, so having the Facebook login makes sense.

*EDIT* Also, registration is not actually disabled. I'm using a mod that forces the user to enter all details in the proper format before he can click the register button. Seems to work fine when creating the account with Facebook.

Are you doing where it sends them an activation code or instant activation?

Yes, The refresh is necessary because it has to run the function again in the header file to see it is logged in on the facebook side. The registration link is there till they click on their activation code to activate there registration, and even then it is a refresh of the page, usually my users just click on something on the site and then they are logged in.
I do not know allot about jquery to see if there is a way of doing all this without a page refresh.

When I tested your site earlier, I logged in with my facebook account and it gave the "agree to terms" and then wanted me to create a password, and that was as far as I got. On my site, after you put in a password for the site then it logs you into your site, whether you use the standard login or facebook.

The disabled button was up the entire time I was on the "enter password" screen of the registration page, even when I put a password in.
UPDATE: I had to click on each field on your reg screen to get the registar button to come on but then I got a syntax error in the header file...
You can PM me to take this off of here and I will post what we find out but I tested my site again and it seems to work just fine, there is a slight delay when registared but it does log the facebook user in. I do not think the dropdown login screen is letting the facebook update. What Mod is that so I can try to add it on my test site?
Buddy Duke
www.budduke.com

Offline zhono

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
Re: [MOD] Facebook Connector V1.0 & V2.0
« Reply #185 on: January 13, 2013, 10:47:26 PM »
I have activation disabled, so it's instant.

I fixed my redirect problems.

I changed:

Code: [Select]
<div id="fb-root"></div>
    <script>
  window.fbAsyncInit = function() {      
        FB.init({
          appId: '{fb_appid}',
          cookie: true,
          xfbml: true
        });
        FB.Event.subscribe('auth.logout', function(response) {
          window.location = '{fb_logout_url}';
        });
      };
      (function() {
        var e = document.createElement('script'); e.async = true;
        e.src = document.location.protocol +
          '//connect.facebook.net/{fb_language}/all.js';
        document.getElementById('fb-root').appendChild(e);
      }());
</script>

To:

Code: [Select]
<div id="fb-root"></div>
    <script>
  window.fbAsyncInit = function() {      
        FB.init({
          appId: '{fb_appid}',
          cookie: true,
          xfbml: true
        });
        FB.Event.subscribe('auth.logout', function(response) {
          window.location = '{fb_logout_url}';
        });
        FB.Event.subscribe('auth.login', function(response) {
          window.location = '{fb_login_url_z}';
        });
      };
      (function() {
        var e = document.createElement('script'); e.async = true;
        e.src = document.location.protocol +
          '//connect.facebook.net/{fb_language}/all.js';
        document.getElementById('fb-root').appendChild(e);
      }());
</script>

And changed in page_header.php:

Code: [Select]
$site_template->register_vars(array(
   "fb_appid" => $config['fb_appid'],
   "fb_language" => isset($lang['fb_language']) ? $lang['fb_language'] : $config['fb_language'],
   "fb_hide1" => $fb['hide1'],
   "fb_hide2" => $fb['hide2'],
   "fb_message" => $lang['fb_message'],
   "fb_loggedin" => $fb['loggedin'],
   "fb_pic_small" =>$user_info['fb_pic_small'],
   "fb_userid"=>$user_info['fb_userid'],
   "fb_name"=>$user_info['fb_name'],
   "fb_logout_url"=>(ROOT_PATH=="./") ? "logout.php" : $site_sess->url($script_url."/".substr(ROOT_PATH,2)."logout.php"),
  ));

to:

Code: [Select]
$site_template->register_vars(array(
   "fb_appid" => $config['fb_appid'],
   "fb_language" => isset($lang['fb_language']) ? $lang['fb_language'] : $config['fb_language'],
   "fb_hide1" => $fb['hide1'],
   "fb_hide2" => $fb['hide2'],
   "fb_message" => $lang['fb_message'],
   "fb_loggedin" => $fb['loggedin'],
   "fb_pic_small" =>$user_info['fb_pic_small'],
   "fb_userid"=>$user_info['fb_userid'],
   "fb_name"=>$user_info['fb_name'],
   "fb_logout_url"=>(ROOT_PATH=="./") ? "logout.php" : $site_sess->url($script_url."/".substr(ROOT_PATH,2)."logout.php"),
   "fb_login_url_z"=>($site_sess->url($self_url)),
  ));

Now it redirects me when I login with Facebook. Also, when I register a new account with Facebook, it sends me to the registration page, but after that the site still won't login the new user. He had to click the Facebook logout, and then login again.

Also about the need to click on the registration fields, I'll probably remove that so it works properly.
As for the login dropdown, it's custom. But even when I completely remove it(by using the standard template) it doesn't help anything.
« Last Edit: January 13, 2013, 10:58:02 PM by zhono »

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Facebook Connector V1.0 & V2.0
« Reply #186 on: January 14, 2013, 12:04:58 AM »
@zhono,
When I registered on your site and put in the password in the registration page, it came back with a "successfully registered" page and waited a few seconds and then the site refreshed and the "login" screen was replaced with the "control panel". I did not have to do anything on my end but there was a few second pause before it did it.
You can remove my account from your site so I can try it again.
Buddy Duke
www.budduke.com

Offline zhono

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
Re: [MOD] Facebook Connector V1.0 & V2.0
« Reply #187 on: January 14, 2013, 12:19:09 AM »
I deleted your account so you can test again. I have been trying it repeatedly, and no matter what I do, when I fill in the password on the registration page, it will say "You are now registered. Please log in." but then it won't refresh. If I refresh it myself, I am not logged into the site, and there is no way to login except to click the Facebook logout, and then click again to login. If it works for you this time, but still not for me, then I really don't know what the problem could be.

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Facebook Connector V1.0 & V2.0
« Reply #188 on: January 14, 2013, 12:52:18 AM »
I now see what you are saying, this time it never did refresh after the registration, it did earlier today. I think it is because you put in the self_url as the target, it actually needs to be directed to the login.php page to actually log you in. The Self_url would only refresh the page you are currently viewing which would be the reg page.

It is now doing the same thing on my site, so facebook probably changed something again,  :(

I probably will not have time to work on it till next weekend, but if you look at the logout link I was using, I think you could mirror the login link to be about the same in your fb_login_url_z code. I always run through allot of tests before I post things. I have been wanting to clean up this code for awhile now, maybe get away from the javascript and keep it all php. not sure right now.

I will post any changes I make when I figure it all out,
Buddy Duke
www.budduke.com

Offline zhono

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
Re: [MOD] Facebook Connector V1.0 & V2.0
« Reply #189 on: January 14, 2013, 01:17:41 AM »
Well, this is embarrassing. It seems I missed step 8.c

So that's why it wasn't logging in the new user after he enters his password.

It still doesn't redirect the user, but just has to click a link and he's logged in. I'll figure out the redirect later I guess. My solution above still works nicely for redirecting existing users after login, though, so I'm leaving it in place.

If I figure out why new users don't redirect after registration, I'll post my solution. Thanks for the help. Now I'm off to redesign my template.

Also, my fb_login_url_z only tells the Facebook script where to send the user after a successful login. Which is why I sent it to the current page. It doesn't actually change the handling of the login itself.


*EDIT*

Fixed the redirect by opening register.php and changing all of the:

Code: [Select]
//MOD facebook
      if ($fb_flag>1){ $msg=$lang['fb_register_success'];}
       $site_sess->set_session_var("fb_flag", 0);
      $fb_flag=0;
      //END MOD facebok

To:

Code: [Select]
//MOD facebook
      if ($fb_flag>1){ $msg=$lang['fb_register_success'];}
       $site_sess->set_session_var("fb_flag", 0);
      $fb_flag=0;
     redirect($site_sess->url("index.php"));
      //END MOD facebok

Now when the user submits his password, he goes right to the home page, completely logged in and ready to go. My new template will contain slideout message to new users, so he will know it was a successful registration when he sees that. No need for the regular success page.
« Last Edit: January 14, 2013, 01:32:50 AM by zhono »

Offline osukaru

  • Pre-Newbie
  • Posts: 4
    • View Profile
Re: [MOD] Facebook Connector V1.0 & V2.0
« Reply #190 on: January 15, 2013, 09:46:18 PM »
Hi,
the last few days I have a problem.
facebook login button sometimes leaves the table, thereby crushing the DIV and you can not use half of the links on the page, as if it was covered.
When the load properly to the table that everything is okay.

My user_loginform.html
<table width="100%" border="0" cellpadding="4" cellspacing="0">

  <
tr

    <
td valign="top" align="left"
{
ifnot fb_hide1}
      <
form action="{url_login}" method="post">

        
	
	
<
table width="100%" border="0" cellspacing="4" cellpadding="0">
<
tr>
<
td width="50">{lang_user_name}</td>
</
tr>
<
tr>
<
td><input type="text" size="10" name="user_name" class="logininput" /></td>
</
tr>
<
tr>
<
td>{lang_password}</td>
</
tr>
<
tr>
<
td><input type="password" size="10" name="user_password" class="logininput" /></td>
</
tr>
        </
table>
        <
br />

        <
table border="0" cellspacing="0" cellpadding="0">

          <
tr valign="top"

            <
td><input type="checkbox" name="auto_login" value="1" /></td>

            <
td><span class="smalltext">{lang_auto_login}</span></td>

          </
tr>

        </
table>

        <
br />

	
	
<
input type="submit" value="{lang_login}" class="button" />

      </
form>

     <
div style="padding:4px;"> &raquo; <a href="{url_lost_password}">{lang_lost_password}</a><br />
     {
endifnot fb_hide1}
     {
ifnot fb_hide2}

	
  &
raquo; <a href="{url_register}">{lang_register}</a></div></td>
     {
endifnot fb_hide2}
     {if 
fb_hide2}
     {
fb_message}
     {endif 
fb_hide2}

  </
tr>
  <
tr><td valign="top" align="center">
  {if 
fb_loggedin}
   <
table width="100%" border="0"><tr><td>
   <
fb:profile-pic uid='loggedinuser' facebook-logo='false'></fb:profile-pic></td><td valign="center" align="left"Witaj,<BR> <fb:name uid='loggedinuser' useyou='false'></fb:name>
   </
td></tr></table>
{endif 
fb_loggedin}
      <
fb:login-button size="small" length="long" autologoutlink="true" scope="email,user_website,publish_stream" ></fb:login-button>
    </
td></tr></table>


Page: poznanskie-autobusy.pl

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Facebook Connector V1.0 & V2.0
« Reply #191 on: January 16, 2013, 01:14:01 AM »
@osukaru,
Click on my site http://www.budduke.com, is this what you are seeing? The button moves around while rendering, a big white box shows up and moves things around till it gets rendered? I clicked on your link for your site but did not see the login button anywhere.

I reported that problem to facebook a few months back, it comes and goes but has been back for awhile lately. They said they would look into it but then closed the bug saying it was by design, whatever that means. I saw someone posted a similer issue today on their bug site, will see if they do anything for them.
All that is in their control and nothing I can do to fix it. It is all embedded in their Javascript package.

I have looked at other sites and talked with a few people and most sites have moved away from the javascript and have started rendering their buttons locally thorugh PHP instead because they got tired of facebook changing things all the time in the javascript language.

When I get time, I think I will be also going that route to get away from these changes all the time but I have no ETA when that will happen, but will post my changes when I feel they are stable enough to post.
Buddy Duke
www.budduke.com

Offline zhono

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
Re: [MOD] Facebook Connector V1.0 & V2.0
« Reply #192 on: February 19, 2013, 02:07:29 AM »
I'm back yet again. I've had everything working nicely, but just noticed another problem. If I'm logged in with facebook, and I click the facebook logout button, it will log me out from facebook, but not from the site. So since you're still logged in, you won't see the standard login link, but you also don't see the logout link either. If I login and out with standard login right from the start, it works fine.

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Facebook Connector V1.0 & V2.0
« Reply #193 on: February 20, 2013, 12:33:36 AM »
I'm back yet again. I've had everything working nicely, but just noticed another problem. If I'm logged in with facebook, and I click the facebook logout button, it will log me out from facebook, but not from the site. So since you're still logged in, you won't see the standard login link, but you also don't see the logout link either. If I login and out with standard login right from the start, it works fine.

Can you PM me a link so I can see the problem in action?

Facebook keeps messing with thier javascript routines. I noticed on my site that when you login with facebook, you have to refresh the page to get it to log into 4images but the logout still refreshes just fine.

Version 3 of this mod will almost be all in PHP, I am moving away from javascript because of all the changes. That seems to be what most sites have done.
Sorry, no ETA. I am finishing up a paying customer right now before I can start back to playing again :)
Buddy Duke
www.budduke.com

Offline zhono

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
Re: [MOD] Facebook Connector V1.0 & V2.0
« Reply #194 on: February 20, 2013, 01:31:48 AM »
Actually, like I said, I have everything else working perfectly. It refreshes on login, and logout. If you login at facebook.com and then visit my site, it will also refresh and log you in. My only problem is that when you click the facebook logout button, it does refresh, but you are still logged into the site. I'll PM the link.
« Last Edit: February 20, 2013, 04:44:46 AM by zhono »