Auto login user after registration
So you want to cut the chase and and make the whole process of registration and login as fast as possible? While others want to be judicious with who signs up on their sites, one request we regularly received was for automatically logging in the user after successful registration. Obviously, for ‘auto login user after registration’ to work, turn on the auto-approval. Auto-Approval is administered by Global Settings —> User accounts: WP Registration Auto Approval checkbox.
Also the form must be a WordPress registration enabled form. This is controlled by General Settings in Form Configuration. When we are creating a new registration form, the option appears as:
On an existing registration form, this option looks like this:
Turning on WordPress user registration first
We’ll use a simple generic form for this demonstration. Auto-login setting is specific to the form. Therefore, we will find it inside Form Configuration of individual forms in Accounts panel. It will only appear if the check box in the above image is checked since it is a sub-setting. We must also select the role that should be assigned to the registrant after successful form submission. Subscriber is always the safest choice. Or we can create custom roles using RegistrationMagic’s built in Role Manager. Alternatively, we can also Let Users Pick Their Role (something which we have covered in the past.)
Let’s turn it on and check Auto login user after registration checkbox.
Auto login user requires redirection
The thing is – once user submits the form, for automatic login to work, the page must refresh once. Since this is not something we can ask user to do, we have redirection as next best option. Redirection will take the user to another page of our choice after registration is successful. Most of the folks using Auto Login will anyway need this, as there’s no sense leaving user stranded on the form page once the formalities are complete. Usually, auto login takes the user to an area otherwise inaccessible to public. A dedicated user account section is a common choice. Re-directions are managed per form by Form Configuration —> Post Submission panel.
The setting is pretty straightforward, labeled as After Submission Redirect User To. We shall select Page in the radio options which opens a drop down list of pages on our site.
We’re are all set now. Let’s test it out. To start with, here’s our form. Nothing fancy.
Testing submission – auto login user after registration
Filling it out now:
Submission successful. Notice the redirection message:
And… in another moment we are at the My Account page logged in as expected.
This is how anyone can use RegistrationMagic to register users and auto login user after registration successfully. We hope this will be useful for a lot of folks out there. You feel we are missing something, feel free to give us a shout and maybe you will see it in the next release. Until next time…
- Experience the Unfolding Magic! - August 4, 2023
- List of Guides for WordPress User Registration Process - July 28, 2023
- Frequently Asked Questions About WordPress User Registration Forms - July 28, 2023
- How to display registration forms on WordPress site? - July 26, 2022
- Create Your First WordPress Registration Page – Starter Guide - July 13, 2022
- WordPress Payment Form Guide: Setup Payments on Registration Form - June 10, 2022
- WordPress Registration Shortcodes List - April 14, 2022
- WordPress User Registration Status Guide - April 9, 2022
- How to add or update user profile fields using WordPress forms - August 5, 2020
- Boost RegistrationMagic User Profiles With ProfileGrid Integration - February 19, 2019