Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @chefnelone,

    Yes, you can add redirect_url in your login shortcode. Like [user_registration_my_account redirect_url = "/my-account"].
    https://docs.wpeverest.com/docs/user-registration/registration-form-and-login-form/how-to-show-login-form/

    Hope this helps!

    Regards!

    Thread Starter chefnelone

    (@chefnelone)

    Hi Rumesh,

    Problem is that I will use the login form in a lot of pages. Question: is there any way to catch the page dynamically with a variable?

    Something like:

    [user_registration_my_account redirect_url = “$GET_CURREN_PAGE”]

    Hi @chefnelone,

    You can use the following code for your purpose. This piece of code will catch your referer page URL and after successfull user login it redirect your user back to the specific page and remove cached URL.

    Please add this code in the function.php file of your theme.

    add_action( 'user_registration_before_customer_login_form', 'ur_set_redirect_url' );
    function ur_set_redirect_url() {
        if ( isset( $_SERVER['HTTP_REFERER'] ) ) {
        set_transient( 'originalLoginRefererURL', $_SERVER['HTTP_REFERER'], 60*60*24 );
    }
    
    }
    
    add_filter( 'user_registration_login_redirect', 'ur_redirect_back', 10, 2 );
    function ur_redirect_back( $redirect, $user ) {
        if ( true === ( $redirect_url = get_transient( 'originalLoginRefererURL' ) ) ) {
            delete_transient( 'originalLoginRefererURL' );
            return $redirect_url;
        }
        return $redirect_url;
    }

    Thanks!

    Thread Starter chefnelone

    (@chefnelone)

    Hi,

    Thank you!

    Hi @rumesh38

    I tried the code [user_registration_my_account redirect_url = "/my-account"]
    on my registration page, but it doesn’t work.

    For some reason, I feel that users are not really paying too much attention to the message they get saying that they need to confirm their registration by going to their email and clicking the link at the bottom of the page once they click Submit.

    I want to create a page just dedicated to that message with additional info and maybe even an image.

    Is that possible?

    Thank you so much! ??

    • This reply was modified 5 years, 8 months ago by Tiago.
    • This reply was modified 5 years, 8 months ago by Tiago.
    • This reply was modified 5 years, 8 months ago by Tiago.

    I also want my users to be redirected back to the page they came from after they register and placed the above code from @rumesh38 in my functions.php file but it didn’t redirect me after i did a test registration. my registration page’s shortcut is just

    [user_registration_form id="581"]

    After registration, the page just says “You are currently logged in as…”

    did i do it wrong?

    • This reply was modified 5 years, 3 months ago by Tech4Eleven.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Redirection after Login form is submitted?’ is closed to new replies.