15 thoughts on “How to make website registration easier using facebook accounts part 2

    • I have included the link to the code in the second part of the tutorial! I hope you find it useful and if you have any other questions, just ask :)

      • It’s work fine :)

        But, in facebook_auth.php, i have change this $username = $user->username; in $username = $user->name;

        and $_SESSION['username'] = $usr['username']; in $_SESSION['username'] = $usr['name'];

        Because graph.facebook.com don’t find username, just name , first_name, last_name :)

        Thank you very much =)

        • Great! But as you can see in the demo, the username is also returned. Well, that is…in case the user has selected a username. If not, your method should be used :)

  1. Thanks for a great tutorial, very well explained and implemented. I tried it on a test site and it works great apart from the post to wall which fetches the variables but doesn’t actually post anything either on the test I did or on your version.


  2. I’m glad you liked it! I have just tested me demo and it worked…are you getting any error or something?

  3. Hi aniri,

    No, there is no error message. I’ve just tested it again from your demo and still no posts, I’m not getting the success message from here either

    var jqxhr = $.post(url, { “access_token”: access_token, “message”: message, “app_id”: app_id },
    function(data) {
    alert(“Status updated successfully!”);
    document.getElementById(‘post_button’).disabled = false;
    document.getElementById(‘status’).value = “”;
    .success(function() { alert(“second success”); })
    .error(function(data, textStatus, jqXHR) {
    if (data.status == 200){
    alert(“Status updated successfully!”);
    document.getElementById(‘post_button’).disabled = false;
    document.getElementById(‘status’).value = “”;
    .complete(function() { });

    It must be something on my PC :)

  4. I have just tried your demo using chrome and it worked well, including posting to my wall and displaying success message. However, when I tried again with Firefox it didn’t post to wall or show success message. Could this have something to do with the Graph API session lasting for a number of days?

    Any way, at least I know it works perfectly.

    Thanks again for a great tutorial and responding to your comments

    • Are you sure the db settings are correct? Did you try and debug a bit? Add some echo statements and check if the data you are trying to save is correct?

    • Hello! You seem to be missing an access token. There might be something wrong with the connection to fb. Did you fill in the required data here:

      “$app_id = “YOUR_APP_ID”;
      $app_secret = “YOUR_APP_SECRETE”;
      $my_url = “YOUR_REDIRECT_URL”;”


      this is from the facebook_auth.php file.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>