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, 2 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #1416

    Backpacking Series
    Buyer
    Post count: 104

    Hello,

    I looked the discussion on login redirect on a previous discussion on this forum and understand that there might be a solution already.

    I have a similar scenario wherein a user needs to return to her / his current location, which I beleive is the default WordPress behavior. However, right now, the user is redirected to home page. A sample URL I need help with is:

    https://www.backpackingseries.com/backpacking-north-east-india-the-book/book-review-guidelines/

    Can someone please help?

    Theme: Gazette (by Automattic)
    WordPress Version: 4.9.2

    Kind regards

    #1417

    Alex Rollin
    Moderator
    Post count: 27815

    Hello,

    Thanks for writing in today.

    Are you referring to the “Login” link/url on page you linked above?

    To bring the user back to the page after registration you will need to add a login/register form to the page with a shortcode; the popup doesn’t ‘know’ the URL of the page where it is being opened, so new user would be sent to the home page after registration. The form has to be ‘inside’ the page to know the page.

    Let us know how it goes

    #1418

    Backpacking Series
    Buyer
    Post count: 104

    Thank you Alex.

    I am editing this response after trying your recommendation. I now have an inline login form. However, it still redirects the user to homepage. Please advise.

    Kind regards,

    #1419

    Backpacking Series
    Buyer
    Post count: 104

    Update,

    The inline login works when using the form – it redirects users to the same page after login. However it sends the user to homepage when using the social login option.

    Please help!

    #1420

    Guust
    Moderator
    Post count: 29970

    Can you check your UsersWP settings please?
    If that is not the issue, post URL and WP admin details and we will have a look.
    Thanks

    #1422

    Backpacking Series
    Buyer
    Post count: 104

    Thank you for the response.

    Yes, the settings look okay. Please see attachment.

    However, while trying to add an user (to provide you admin access) through the admin screen, I get the following error:

    
    
    Warning: in_array() expects parameter 2 to be array, null given in /plugins/wordpress-seo/inc/sitemaps/class-sitemaps-cache.php on line 201
    
    Warning: Cannot modify header information - headers already sent by (output started at /plugins/wordpress-seo/inc/sitemaps/class-sitemaps-cache.php:201) in /wp-includes/pluggable.php on line 1216

    I am not sure what is this error related to – UsersWP or SEO plugin. I’ve raised a query with Yoast support.

    Your guidance is welcome too!

    Kind regards

    #1424

    Guust
    Moderator
    Post count: 29970

    If that is not the issue, post URL and WP admin details and we will have a look.
    Thanks

    #1425

    Backpacking Series
    Buyer
    Post count: 104

    Got it. Thank you

    Will do so as soon as I am able to resolve this issue to add a new user.

    Kind regards,

    #1426

    Backpacking Series
    Buyer
    Post count: 104
    This reply has been marked as private.
    #1427

    Guust
    Moderator
    Post count: 29970

    That page does not request a login?
    Redirect to the previous page will only work if they visit a page that requires a login.
    Can you give an example of such a page?
    Thanks

    #1428

    Backpacking Series
    Buyer
    Post count: 104

    Yes, it does have a login form. Please scroll to the box. See attachment.

    URL: https://www.backpackingseries.com/backpacking-north-east-india-the-book/book-review-guidelines/

    Kind regards

    #1430

    Backpacking Series
    Buyer
    Post count: 104

    The problem scenario occurs with social login option only.

    #1431

    Guust
    Moderator
    Post count: 29970

    But you can see the page without being logged in, so if you choose to go to the login page, instead of being forced to login, redirects do not work.
    Do you have an example of a page that requires a login, meaning a page you cannot see unless you are logged in?

    #1432

    Backpacking Series
    Buyer
    Post count: 104

    Actually, the same box has protected content. Once you login, the protected content is visible to the user. (While a guest only sees the login form.)

    #1433

    Guust
    Moderator
    Post count: 29970

    But it still does not force you to login. So I guess you do not have an example of a page that requires a login, meaning a page you cannot see unless you are logged in?

Viewing 15 posts - 1 through 15 (of 31 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket