• Resolved nellolux

    (@nellolux)


    Hello,

    Great plugin!

    I’m wondering if it is possible to have a redirection to last visited page after that the user validate the account clicking on the validation link sent by email. Let’s say that the user is browsing and he’s visiting a product page, then if register from that page, when he clicks on the validating link sent by mail he should be redirected to that product page.

    If someone of your developers is available, I’m ready to pay for developing this feature.

Viewing 1 replies (of 1 total)
  • Deepak Sharma

    (@sharmadpk03)

    Hi @nellolux,

    Sorry for the delayed response.
    You can do that using a piece of code. Please paste the following code in your active theme’s functions.php file at the end and it will do the trick.

    add_action( 'user_registration_before_registration_form', 'ur_set_register_redirect_url' );
    function ur_set_register_redirect_url( $form_id ) {
    	if ( isset( $_SERVER['HTTP_REFERER'] ) ) {
    		set_transient( 'originalLoginRefererURL', $_SERVER['HTTP_REFERER'], 60 * 60 * 24 );
    	}
    }
    add_filter( 'user_registration_redirect_from_registration_page', 'ur_register_redirect_back', 10, 2 );
    function ur_register_redirect_back( $redirect, $user ) {
    	if ( true === ( $redirect_url = get_transient( 'originalLoginRefererURL' ) ) ) {
    		delete_transient( 'originalLoginRefererURL' );
    		return $redirect_url;
    	}
    	return $redirect_url;
    }

    Let me know if it helps or not and I will get back to you.
    Regards!

Viewing 1 replies (of 1 total)
  • The topic ‘Redirect to last page visited after registration’ is closed to new replies.