• Resolved nilsabegg

    (@nilsabegg)


    Hello there,

    first of all, thank you for that awesome plugin. It was exactly what I needed. Unfortunately I encountered some unexpected behavior.
    I placed login and registration on one page via shortcodes. When I trigger an action that requires an user account, I get my Login/Registration page with the correct parameter for redirect_to in the URL. When I now register, I am getting logged in and redirected to the homepage.
    I checked the code and stumbled upon this:
    functions.php Line 746:
    $url = apply_filters('login_redirect',home_url(),tml_get_request_value('redirect_to'), $user);

    Why is the home_url passed as second parameter? Is this some kind of feature that I didn’t understand?
    When you replace Line 746 in functions.php with this code, it’s working as i would have expected it to work:

    
    if (tml_get_request_value('redirect_to') == '') {
                $url = apply_filters( 'login_redirect', home_url(), tml_get_request_value( 'redirect_to' ), $user );
            } else {
                $url = apply_filters( 'login_redirect', tml_get_request_value( 'redirect_to' ), $user );
            }

    But I am not sure if this is not breaking something else. I didn’t encountered any bugs, but I didn’t test all the features.

    Best Regards
    Nils

    • This topic was modified 2 years, 4 months ago by nilsabegg.
    • This topic was modified 2 years, 4 months ago by nilsabegg.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jeff Farthing

    (@jfarthing84)

    This is by design, as generally, registration doesn’t have any redirect. You can always apply your version as a higher priority of the login_redirect filter.

    Thread Starter nilsabegg

    (@nilsabegg)

    Thank you for your reply. And your hint with the login_redirect filter solved my problem in a way that I can still update your plugin. So thank you again.
    But I have to disagree with your assumption that registration doesn’t have redirects. Let’s assume you have some kind of website that allows more kinds of interactions…like reviews. So when the visitor wants to create a review, he will get to the login/registration page..and when he now registers, he lands on the homepage instead of the review form.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Redirect after Registration with Auto Login’ is closed to new replies.