Created
February 6, 2012 17:17
-
-
Save labsecrets/1753434 to your computer and use it in GitHub Desktop.
Wordpress and BuddyPress - Redirect Back to Last Page After Login
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*------------------------------------------------------------------*/ | |
/* Redirect Back to Last Page After Login */ | |
/* Adam J Nowak - */ | |
/* http://code.hyperspatial.com/1353/bp-admin-bar-login-redirect */ | |
/*------------------------------------------------------------------*/ | |
function lab_login_redirect(){ | |
global $bp; | |
remove_action('bp_adminbar_menus','bp_adminbar_login_menu',2); | |
if(is_user_logged_in()) return false; | |
$url = get_bloginfo('home') . '/wp-login.php?redirect_to=' . urlencode(get_bloginfo('home')) . esc_url($_SERVER['REQUEST_URI']); | |
echo '<li class="bp-login no-arrow"><a href="' . $url . '">' . __( 'Log In', 'buddypress' ) . '</a></li>'; | |
if(bp_get_signup_allowed()) echo '<li class="bp-signup no-arrow"><a href="' . bp_get_signup_page(false) . '">' . __( 'Sign Up', 'buddypress' ) . '</a></li>'; | |
} | |
add_action('bp_adminbar_menus','lab_login_redirect',1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment