WordPress.org

Ready to get started?Download WordPress

Forums

Simple Facebook Connect
[resolved] Logout issue with patch (2 posts)

  1. John Kleinschmidt
    Member
    Posted 2 years ago #

    Otto,

    I noticed an issue with the latest (1.1) when logging out under unusual circumstances.
    The scenario:
    1) I was logged into my WP site with user "A". User "A" had been logged in using FB connect.
    2) I wanted to test a test FB user, so I went over to FB's developer site and switched to a test FB user that wasn't registered for my site.
    3) I then attempted to logout of my WP site and got an FB js error (FB.logout() called without an access token.)

    I know this is a strange situation that may not happen in real life, but I found that if you check for FB.getAuthResponse() before FB.logout, it avoids this issue. Anyway, if its useful, here's the patch from my fix:

    Index: sfc-login.php
    ===================================================================
    --- sfc-login.php       (revision 444964)
    +++ sfc-login.php       (working copy)
    @@ -196,9 +196,13 @@
     function sfc_login_logout_js() {
            $redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?loggedout=true';
     ?>
    +if (FB.getAuthResponse()) {
     FB.logout(function(response) {
            window.location.href = '<?php echo $redirect_to; ?>';
     });
    +} else {
    +       window.location.href = '<?php echo $redirect_to; ?>';
    +}
     <?php
     }

    http://wordpress.org/extend/plugins/simple-facebook-connect/

  2. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 2 years ago #

    Looks good. I'll put it in trunk.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic