BP-FBConnect Login Button (and Logout, too)
-
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 & FacebookBP Function is:
Log OutI 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.2Thanks for any help you can lend,
Graham
-
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>
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>
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>"; } }
- The topic ‘BP-FBConnect Login Button (and Logout, too)’ is closed to new replies.