Hi,
In which cases precisely doesn’t it work as you would like?
Hello,
When I login with the specific user, they are automatically redirected to the Customer Area Dashboard page rather than redirecting to the link I’ve set up in Peter’s redirect login. When I deactivate the CA plugin, the redirect works as planned for that user.
Is there any way to modify the CA plugin’s redirect after login? With Peter’s redirect login plugin, I can choose a setting that will check a particular file first and then proceed with the other redirects. I just need to know where to look to adjust the code in the CA plugin.
Thank you
This happens in the plugin.class.php file, in function login_then_redirect_to_url
I think without touching the plugin, this could work:
add_filter('cuar/routing/login-url', 'cuar_disable_login_redirect');
function cuar_disable_login_redirect($original_url) {
return '';
}
Also note that we have a specific add-on to handle login forms nicely, maybe this would work for you too.
I have the login form add-on already. I do like it and it works well, thank you.
I inserted the code above into the functions.php file but it is still redirecting to the CA dashboard page rather than what I’ve set up. Any other recommendations?
I see, this is not working because the login forms add-on is installed.
Currently there is no filter to disable redirection with the login forms add-on.
Temporarly, you can edit the login forms’ add-on file “customer-login-addon.class.php” and comment the line:
wp_redirect( !empty( $redirect ) ? $redirect : home_url(), 302);
Let me know if that is better
Removed the line from functions.php and commented out the line within the login add-on but it still is not redirecting as intended. Any other ideas?
I had a quick look at Peter’s plugin and this may work:
edit the login forms’ add-on file “customer-login-addon.class.php” and replace the line:
wp_redirect( !empty( $redirect ) ? $redirect : home_url(), 302);
by
$redirect_to = !empty( $redirect ) ? $redirect : home_url();
$user = wp_get_current_user();
wp_redirect(apply_filters('login_redirect', $redirect_to, $redirect_to, $user), 302);
That worked! Thank you so much for your prompt responses and help!
I will include this fix in the next release.