Skip to:
Content
Pages
Categories
Search
Top
Bottom

BP-FBConnect Login Button (and Logout, too)

Viewing 3 replies - 1 through 3 (of 3 total)

  • 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>


    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>


    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.
Skip to toolbar