Support » Plugin: Private BuddyPress » [Plugin: Private BuddyPress] Make redirect URL a changeable option

  • Resolved rnm3


    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!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Dennis Morhardt


    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.

    Thanks a lot! I’m going to have a look into this soon…

    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.


Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Private BuddyPress] Make redirect URL a changeable option’ is closed to new replies.