Facebook Connect for phpBB2

Another mod for phpBB2 that I have just completed is the well sought after “Facebook Connect” mod.  It’s a very straightforward version and should be very simply to install, though I give no guarantee that it will work for you.

I used to JavaScript Api to get the job done.  In a nutshell what it does is it first adds in a column to your User’s table to store someone’s Facebook ID.  Then the first time a user clicks on the “facebook connect” button it will ask the user if they want to link to an existing account or create a new one.  It will then add in the facebook ID to th row for the selected account.  Then the next time a user clicks on the “Facebook Connect” button it will check the User’s table for the user’s facebook ID and automatically log them in.

So, like I said, pretty straight forward.  The forum account will still work independently from Facebook, but will give the user instant activation and a faster way to login.

Features:

  • Instant account activation.
  • Single click log in when user is already logged into Facebook.
  • Allows for linking/unlinking for logged in users.
  • Will add the user’s Facebook avatar if they don’t already have one.

Click here to download the mod

8/02/10 Minor edit needed: It reads “Please submit both an email and password” which should be changed to “Please submit both a username and password”




Tags: , , , ,
This entry was posted on Thursday, July 8th, 2010 at 11:40 pm and is filed under PHP, Scripting. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
13 Comments to “Facebook Connect for phpBB2”
  1. HNRBot says:

    Very nice mod! Truly appreciated. Only one thing: It works only after I click my regular ‘Login’ button that takes me to my login page. It does not work straight from my message board Index page. Can you help with this issue please?

  2. admin says:

    Did you do some modding? It gives me a “you have been banned” warning when I try to test it out on your site.

    The facebook registration shouldn’t need any extra spam protection since that’s already being handled by facebook (at least in theory)

  3. HNRBot says:

    The only modding that I did that could probably affect this is the myspace mod for phpbb2…What I have noticed by checking out the phpbb database is that the mod does not create a user_id for a member who chooses to login with his facebook credentials. To make it work I have to manually update the user_id. Maybe you can help me with this issue.

    On another note, is there anyway to make the mod use the larger avatar from facebook instead of the thumbnails? Thanks again for replying.

    • Foxumon says:

      Did the “facebook_id” column get added to your users_table? If your users table isn’t “phpbb2_users” you’ll have to change the SQL “ALTER TABLE `phpbb2_users` ADD `facebook_id` INT( 20 ) NOT NULL;” to what your user table is named. If you have phpMyAdmin it’s prolly easier to use that to add in the column.

      Changing to the larger picture is pretty simple, search facebook.php for “/picture” it should show up in two places. After it add in “?type=large” so they both look like “/picture?type=large” and that should do the trick.

      • HNRBot says:

        The facebook id was added to my users table but it doesn’t get updated with the facebook id and that’s why you get the message ‘you have been banned’. Now if I add your fb id it will work. There is something preventing the FB id from being added at registration. Help?

  4. Stirling says:

    Hi,
    I’m testing out your mod on a test site before putting it on my live forum. My test site is here:
    http://www.rollsroyceforums.com/newforums/

    I’ve setup my application in Facebook and added my app ID in the appropriate places, but as you can see nothing happens when I click on the FB Connect button.

    Any ideas?

    Thanks for building this mod, BTW.
    Stirling

    • Foxumon says:

      Hi Stirling,

      It looks like you don’t have JSON support on your server, your facebook/all.js.php file is coming up with an error:

      Call to undefined function: json_encode()

      Try commenting out line 92 on facebook/all.js.php, or you can try replacing the contents with this file

      • Stirling says:

        commenting out line 92 definitely got us closer… it let me connect to Facebook and then directed me back to the forum. However when it got to the “One time only Facebook connect setup” and I entered a username and password, it then redirected me like this:
        http://www.rollsroyceforums.com/newforums/http://www.rollsroyceforums.com/newforums

        (the same url, doubled)

        • Foxumon says:

          I think that may be a result of another mod you have…try exchanging:

          $url = ( !empty($HTTP_POST_VARS['redirect']) ) ? str_replace(‘&’, ‘&’, htmlspecialchars($HTTP_POST_VARS['redirect'])) : “index.$phpEx”;
          redirect(append_sid($url, true));

          for

          header(‘Location: index.php’);
          exit;

          on line 39 of facebook.php

  5. rosalindprazeres says:

    Just wanted to take a second and say howdy to everyone. Looking forward to your forum and what everyone here has to say.

  6. Darko Martic says:

    There is one thing I cannot figure out…

    The first time a user clicks FBconnect and grant permission in FB popup, on a page where he is about to login to his existing account, as I understood a user is also able to create a new forum account?

    Well, no matter what I try I keep getting the next error message:
    “That e-mail adress is already being used on this Forum”
    But, I checked the username which I’m typing and it is NOT in use or existing in database. I even try entering e-mali address in username field, but with no luck.
    That error message shows up.

    Thank you,
    regards

  7. Darko Martic says:

    My mistake about previous question/problem…

    I was translating facebook.php to my (Croatia) language, and changed the “value” for button which is actually a “action” triggered in facebook.php

    It works now great !!

    Thank you,
    regards

Leave a Reply

(required)

(required)