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
  • Author
    Posts
  • #1434

    Backpacking Series
    Buyer
    Post count: 104

    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?

    #1436

    Guust
    Moderator
    Post count: 29970

    If 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.

    #1437

    Backpacking Series
    Buyer
    Post count: 104

    Yes, 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,

    #1438

    Guust
    Moderator
    Post count: 29970

    We 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.

    #1439

    Backpacking Series
    Buyer
    Post count: 104

    Thank 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

    #1448

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    This will be in the next release.

    Thanks,

    Stiofan

    #1451

    Backpacking Series
    Buyer
    Post count: 104

    Thank you Stiofan!

    Kind regards,

    Abhijeet

    #1527

    Backpacking Series
    Buyer
    Post count: 104

    Hello,

    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

    #1528

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    if 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

    #1529

    Backpacking Series
    Buyer
    Post count: 104

    Thank 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

    #1561

    Patrik
    Moderator
    Post count: 1971

    Hi 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,
    Patrik

    #1562

    Backpacking Series
    Buyer
    Post count: 104

    Hi 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

    #1563

    Patrik
    Moderator
    Post count: 1971

    Hi 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,
    Patrik

    #1569

    Backpacking Series
    Buyer
    Post count: 104

    Thank you Patrik.

    Do we have an ETA for the next version?

    Kind regards

    Abhijeet

    #1571

    Patrik
    Moderator
    Post count: 1971

    Hi 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

Viewing 15 posts - 16 through 30 (of 31 total)

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

Open Support Ticket