Hi @franktcmarketing
Does the Login link have the redirect_to
in the URL parameter?
Regards,
Did not 🙁
I just wrote or actually used the editors link.
So it would have looked more like the straight page link.
website/login
OK, I looked that up and have it working but will have to enter new message& login link for each protected page and Post.
I have:
https://MYWEBSITE/members/login/?redirect_to=https://MYWEBSITE/members/members-area/
Granted that would still get them logged in and they can find what ever post they were on and not have to login again.
I can certainly add Custom Restrict message & Link for each new post.
Like:
https://MYWEBSITE/members/login/?redirect_to=https://MYWEBSITE/members/New-Post
However if you can share a link format that would work in the Global Default Message that would not specify a link/page to send them back to but would send them back to whatever page they cam from??
Hi @franktcmarketing
Sorry for the late response.’
Could you please try this code snippet to redirect users back to previous visited page?
// Login Referrer
add_action("um_after_login_fields", function(){
if( isset( $_SERVER['HTTP_REFERER'] ) || isset( $_POST['redirect_to'] ) ){
if( isset( $_POST['redirect_to'] ) ){
$redirect_to = $_POST['redirect_to'];
}else{
$redirect_to = $_SERVER['HTTP_REFERER'];
}
echo "<input type='hidden' name='redirect_to' value='".esc_attr( $redirect_to )."'>";
}
});
You can add the code snippet to your theme’s function.php file or use Code Snippet plugin.
Feel free to re-open this thread by changing the topic status to “Not Resolved” so we can get back to you.
Regards,
-
This reply was modified 4 years, 3 months ago by
Champ Camba.