Stop redirection on Membership 2 form submission on Hustle Popup

I like to have Membership Pro a login form in Hustle popup but need the form not to redirect to account page just stay on the page where the user submits the form.

  • Konstantinos Xenos

    Hi Adam !

    You could add the following code to your themes functions.php.

    function adm_redirect_to_previous_page( $user, $request ) {
    	if ( ! empty( $request['membership_id'] ) ) {
    		$user->add_membership( $request['membership_id'] );
    	}
    
    	header( 'Location: ' . $_SERVER['HTTP_REFERER'] );
    
    	exit;
    }
    add_action( 'ms_controller_frontend_register_user_complete', 'adm_redirect_to_previous_page', 10, 2 );

    What this does is basically letting the plugin do it's magic on registering your users properly and adding them into any membership that you might have ( if any ) and then get their browser back to the original page.

    Make sure to keep a backup before proceeding on any changes on your own to be safe. If you don't feel comfortable on editing your themes files you can grant us access sending a private message through our contact form: https://premium.wpmudev.org/contact/#i-have-a-different-question

    Send as:
    
    Subject: "Attn: Konstantinos Xenos"
    
    - Admin login:
        Admin username
        Admin password
        Login url
    
    - FTP credentials
        host
        username
        password
        (and port if required)
    
    - link back to this thread for reference
    - any other relevant urls

    Best regards,
    Konstantinos

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.