I tried doing something like this in the template for the loginpage:
$current_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
if (is_user_logged_in() && (!(strpos($current_url, 'logout') == true) || !(strpos($current_url, 'password') == true))) { ?>
<meta http-equiv="refresh" content="0; URL='https://www.google.com'"/>
<?php }
My aim here was to have the redirect work via PHP on the my-account page (thanks to the template) which actually works but it also redirects from the logout and edit password tabs so I can’t logout any longer.
I tried another attempt but can’t get it to work either.
I went to your plugin’s template folder and took the dashboard.php and made a copy of it.
I put that copy into [mytheme]/user-registration/myaccount/ and edited it.
Then I added something like
if (is_user_logged_in()) {
echo 'USER_IS_LOGGED_IN: ';
}
to it but it doesn’t ever show up.
If I do the same with the my-account.php instead, it shows me the USER_IS_LOGGED_IN but obviously at the bottom of ALL tabs (including password and logout tab).
However I want this ONLY in the first tab, the dashboard tab.
Because if that works I can replace the echo-statement by a wp_redirect and my problem is solved.
Do you know what I am doing wrong?
Please help me as soon as you can since I’m a bit in a hurry with this task. 🙁
-
This reply was modified 3 years, 4 months ago by sabineline.
Hi @sabineline,
We are really sorry for the delayed response. We do have a documentation guide to redirect the user to any specific page after the login. I recommend you to follow this documentation to redirect users to any pages after a successful login: https://docs.wpeverest.com/user-registration/docs/login-redirect-didnt-work/
Do let me know whether it helps or not and at the same time correct me if you are looking for something else.
Thanks and Regards!