Hello,
I don’t mean to send this support here. But I really like to get this going…
Anyway, I used this function in the bp-custom.php. https://buddydev.com/snippets/tag/redirect/
I did created a new page DUMMY, published. choose Static page, then drop-down to select the DUMMY page. SAVED, also saved PERMALINK, even cleared all cache and purge, etc…
It’s only go to the profile page after logged-in, BUT, It wouldn’t go to the register page after logged-out? I also tried as a temp-user.
Please help, why is not working for the register page? I did every steps accordingly.
Thanks
Hello Jimmy,
Thank you for posting. Please try using the code from the following link:
https://buddydev.com/support/forums/topic/redirect-loggedout-users-to-a-register-page/#post-17130
Please let me know if it works or not.
Regards
RaviHi Ravi,
Yahoo and Way2Go! It works like a charm using this function. I now selected the dropdown and changed to the register page, It go straight to the register page after logged-out.
OMG! Thank you so very much for helping me.
Hi Ravi,
This is an update information
My bad, I now realized, instead NOT going to the profile page after logged-in or even when I click the site logo, it goes to the members page instead NOT the profile page?
Please help help,
Thanks,Hello Jimmy,
Please remove all previous code and use the following code:
/** * Redirect user on logout. * * @param string $logout_url logout url. * @param string $redirect where to redirect. * * @return string */ function buddydev_custom_logout_url( $logout_url, $redirect ) { if ( ! function_exists( 'buddypress' ) ) { return $logout_url; } $redirect = bp_get_signup_page(); $args = array( 'action' => 'logout' ); $args['redirect_to'] = $redirect; $logout_url = add_query_arg( $args, site_url( 'wp-login.php', 'login' ) ); $logout_url = wp_nonce_url( $logout_url, 'log-out' ); return $logout_url; } add_filter( 'logout_url', 'buddydev_custom_logout_url', 100, 2 ); /** * Modify custom login redirect url * * @param string $login_url Login url. * * @return string */ function buddydev_custom_login_url( $login_url ) { if ( ! function_exists( 'buddypress' ) ) { return $login_url; } $login_url = remove_query_arg( 'redirect_to', $login_url ); $new_redirect_url = trailingslashit( bp_get_members_directory_permalink() . 'me' ); $login_url = add_query_arg( 'redirect_to', $new_redirect_url, $login_url ); return $login_url; } add_filter( 'login_url', 'buddydev_custom_login_url' );
Regards
RaviOMG YES Ravi,
You hit it right on the nose 🙂 I even tested dozen of times. Works like a charm!!!
Thank you so much for your big time help again and again!!!
—————–
P.S. Ravi, I’m still wondering, why sending logged-out members to the register page that they already have an account.
What about a function to send ALL (ANY) visitors who landed on the homepage or any pages that was NOT LOGGIN to the REGISTER PAGE instead.
Hello Jimmy,
Please look at the following blog to make the site private.
https://buddydev.com/making-a-wordpress-buddypress-site-private-the-right-way/
Please let me know if it helps or not.
Regards
RaviHi Yogi,
There must be a demon on my site LOL, I had tried dozen of different ways and keep staying on the homepage as visitor.
Can you help me with the correct url to see what I’m doing wrong?
The ONLY line I changed/add for this function is this below.
$redirect_url = wp_login_url( site_url(‘/https://ThisIsMySite.com/register.php/’) );//get login url,
Please help help,
Thanks
The topic ‘ [Resolved] Logout and redirect to Register’ is closed to new replies.