How to Set Default Login Redirect to Current User Location?
This topic contains 30 replies, has 5 voices, and was last updated by Backpacking Series 6 years, 9 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
January 27, 2018 at 12:31 pm #1434
Well, the protected content requires login to access.
Edit: “This content is for registered users only. Please login.” – This text is followed by the login form. After login, when the user returns to this page, she does not see the login form anymore. Instead she sees a different form. Please see attachment for reference.
What am I missing? My apologies if I do not fully understand the technicality here. Could you please explain?
January 27, 2018 at 12:55 pm #1436If a page FORCES you to login, then it should redirect.
If you CHOOSE to login, then you CHOOSE to go to the login page and the login page does not know where you came from.Here is an example: try accessing this page, and then look at the URL:
https://wpgeo.directory/docs/add-listing/?listing_type=gd_place
See how the URL now adds the redirect?https://wpgeo.directory/docs/login/?redirect_to=https://wpgeo.directory/docs/add-listing/?listing_type=gd_place
That pages FORCES you to login, and then will redirect you.
I hope that explains it a bit better.
January 27, 2018 at 1:23 pm #1437Yes, thank you Guust. That was helpful to understand.
Which means the following scenarios wont work:
1. UsersWP Login form cannot be used inside a popup for a redirect to work. (Test Result: Redirect fails for both login form and social login option)
2. UsersWP login form cannot be embedded inline (on a particular page) for a user to be redirected to the same page and location. (Test Result: Redirect fails for social login but works when user types UID and PWD on the login form)
3. A link to UsersWP login page on top of the protected content. (Test Result: Fails either way)These scenarios wont work (or work partially) since all are chosen actions, not forced. Hope I got that right.
So, I guess, I should look up a method to force direct a user to login to access protected content on that page? Will let you know how goes.
Kind regards,
January 27, 2018 at 10:15 pm #1438We will be looking at this as an improvement for the next update, as a settings option, so that if you choose to login from a page, you also will be redirected back to that page.
Thanks.
January 28, 2018 at 6:59 am #1439Thank you Guust.
At this time, given my limited technical skills, I cannot figure out a way to force-redirect a user to login to access a section of a webpage. It’d be really helpful to see a feature like that in the next update.
Kind regards
Abhijeet
January 29, 2018 at 12:06 pm #1448This will be in the next release.
Thanks,
Stiofan
January 29, 2018 at 12:42 pm #1451Thank you Stiofan!
Kind regards,
Abhijeet
February 10, 2018 at 11:50 am #1527Hello,
Thank you for the updates to the UsersWP plugin, delivered last week. I noticed the new redirect setting as – Last user page.
This is just a follow up whether this issue has been fixed in the new release – since a user continues to be redirected to home page, especially when using the social login widget from a sidebar?
Thank you
February 10, 2018 at 11:55 am #1528if the redirect is not specifically set in the url then they should be redirected to the last page the user was on. I am not sure if Patrik tested this with social login, i’ll flag this for him to reply to on monday.
Thanks,
Stiofan
February 10, 2018 at 12:00 pm #1529Thank you Stiofan! Look forward to an update.
PS: I am unable to insert the [uwp_login] shortcode in the pages given the form-distortion issue pursued in this thread. Hence the reliance on social login widget.
Kind regards,
Abhijeet
February 12, 2018 at 10:39 am #1561Hi Abhijeet,
We have applied a fix for social media add on which will redirect to last user page instead of home page all the time. It will be released in next version.
Also, Regarding page with [uwp_login] shortcode, we have added “uwp_page” class in body for all UWP pages. So if you want to use the same shortcode on other pages can add the class in the body by putting following code in your style.css of the current theme.
add_filter( 'body_class', 'uwp_add_body_class_for_shortode', 10, 1 ); function uwp_add_body_class_for_shortode( $classes ) { global $post; if ( isset($post->post_content) && has_shortcode( $post->post_content, 'uwp_login' )) { $classes[] = 'uwp_page'; } return $classes; }
You can modify this function for other shortcodes also if you want to use them on non UWP pages. Let me know if this works for you.
Regards,
PatrikFebruary 12, 2018 at 11:02 am #1562Hi Patrik,
Thank you for the advice on both issues.
I just want to clarify whether to
add the class in the body by putting following code in your style.css of the current theme
(as recommended in your message)
or to add the code in functions.php file?
I am not a programmer but this code looks like a functions.php stuff rather than styling. PS: Is this something that might also feature in the next version?
Kind regards,
Abhijeet
February 12, 2018 at 11:55 am #1563Hi Abhijeet,
Sorry! My mistake, You need to add it in functions.php file of the current theme. We will apply the fixes in the future release when you can remove the code.
Regards,
PatrikFebruary 12, 2018 at 12:24 pm #1569Thank you Patrik.
Do we have an ETA for the next version?
Kind regards
Abhijeet
February 12, 2018 at 12:41 pm #1571Hi Abhijeet,
We have just released a minor version recently so we can say we will release the next version soon. You can get back to Stiofan anytime to get the update about the next version release.
Let me know if you have any other queries or I can close this ticket.
Thanks,
Patrik -
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket