Skip to:
Content
Pages
Categories
Search
Top
Bottom

BP-FBConnect Login Button (and Logout, too)

  • Profile photo of grahamlindsey
    grahamlindsey
    Member

    @grahamlindsey

    Hi all,

    I’ve installed BP-FBConnect and it plays very nicely with my BP installation. The only question I have is about integrating it with the BP menu bar:

    Is there an elegant way to make the “Logout of Site & Facebook” link and the BP My Account > Log Out (through the BP menubar) buttons have the same functionality? The catch is, some users won’t login using their Facebook accounts, so I can’t just hard code the change on the Log Out menu item.

    BP-FBConnect function is this:
    Logout of Site & Facebook

    BP Function is:
    Log Out

    I can’t logout using BP if I’ve logged in with BP-FBC, and when I hit the usual “Login” button, it brings up the standard WP login screen. Ideally I want to inject the code for the BP-FBC into that page (which I’m doing) and tie-in the Logoff / Log Out functionality of both WP and BP-FBC.

    WP 3.0.5 (not 3.1 until BP will work in that environment)
    BP 1.2.7
    WP-FBC 1.2

    Thanks for any help you can lend,
    Graham

Viewing 3 replies - 1 through 3 (of 3 total)
  • Profile photo of grahamlindsey
    grahamlindsey
    Member

    @grahamlindsey

    Apologies – missed putting the code in backticks:

    BP-FBConnect function is this:
    <a href="#">Logout of Site & Facebook</a>

    BP Function is:
    <a id="bp-admin-logout" class="logout" href="http://mysite.com/wp-login.php?action=logout&redirect_to=http%3A%2F%2Fmysite.com&_wpnonce=996ffd0d7e">Log Out</a>

    Profile photo of ORyanMcentire
    ORyanMcentire
    Member

    @oryanmcentire

    What happens if you try adding that onclick action to your BP log out?

    <a id="bp-admin-logout" class="logout" href="http://mysite.com/wp-login.php?action=logout&redirect_to=http%3A%2F%2Fmysite.com&_wpnonce=996ffd0d7e">Log Out</a>

    Profile photo of Dj Kad
    Dj Kad
    Participant

    @dj-kad

    I made this: Add this code at the end of functions.php file included in your theme.
    It adds “Login – Register” or “Logout” buttons to your nav menu:

    
    add_filter('wp_nav_menu_items','add_login_buttons');
    function add_login_buttons ($nav){
    if ( is_user_logged_in() ) {
    return $nav."<li id='menu-item-10' class='menu-item menu-item-type-post_type menu-item-object-page'><a href='".wp_logout_url( home_url() )."'>Exit</a></li>";
    }
    else {
    return $nav."<li id='menu-item-51' class='menu-item menu-item-type-post_type menu-item-object-page menu-item-51'><a href='http://www.sitename.com/loginpage'>Login</a></li><li id='menu-item-51' class='menu-item menu-item-type-post_type menu-item-object-page menu-item-51'><a href='http://www.sitename.com/registerpage'>Sign Up</a></li>";
    }
    }
    
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘BP-FBConnect Login Button (and Logout, too)’ is closed to new replies.