WordPress.org

Ready to get started?Download WordPress

Forums

Private BuddyPress
[resolved] Make redirect URL a changeable option (4 posts)

  1. rnm3
    Member
    Posted 3 years ago #

    Hi Dennis,

    your plugin works great so far and really is a big help!! Thank you for your great work!

    I'd just like to add a wish for the next version, as I currently have the situation that I don't want to redirect to the wp-login.php but to the homepage where the user can choose to register or login (kind of like on Facebook). In my installation no one is supposed to see the ugly wp-login.php at all and I'd like to keep it that way.

    For now I changed the redirect URL manually (line 94) but unfortunately the ?redirect_to= is being ignored then. Do you have an idea how to fix that?

    Thanks a lot & best wishes!
    .tim

    http://wordpress.org/extend/plugins/private-buddypress/

  2. Dennis Morhardt
    Member
    Plugin Author

    Posted 3 years ago #

    In 1.0.3 (released today) for this exists now a filter. You can add this function to your functions.php to change the URL where users being redirected if they not logged in:

    function redirect_nonloggedin_users($current_uri, $redirect_to) {
    	// Redirect users to the homepage
    	// Caution! Exclude the homepage from 'Private BuddyPress' options
    	// to avoid redirection loops!
    	return get_option('siteurl') . '/?from=' . $redirect_to;
    }
    
    add_filter('pbp_redirect_login_page', 'redirect_nonloggedin_users', 10, 2);

    You can change the line that starts with 'return' and remove the from value if it not needed.

  3. rnm3
    Member
    Posted 3 years ago #

    Thanks a lot! I'm going to have a look into this soon...

  4. keress
    Member
    Posted 3 years ago #

    Thanks for the function code, but I'm a little confused. Am I supposed to be able to specify which file I want the redirect going to? If so, where do I add that? The page I want to use has an ID # of 157. I tried replacing the two numbers at the very end with that, but it's still redirecting to the home page.

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic