Skip to:
Content
Pages
Categories
Search
Top
Bottom

Redirect user to previous page


  • Jacks89
    Participant

    @jacks89

    Hi I am very new to Buddypress.

    I’m having issue trying to redirect user to the previous page after they log in rather than sending the user to profile page.

    Whenever I type egglove.sg/login, it redirects me back to egglove/profile/login.

    How do I change this?

    I have come across the code below

    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);

    But doesn’t seem to work when I add it bp-custom.php in plugin folder or function.php in theme folder.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Redirect user to previous page’ is closed to new replies.
Skip to toolbar