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…
- How to add or update user profile fields using WordPress forms - August 5, 2020
- Boost RegistrationMagic User Profiles With ProfileGrid Integration - February 19, 2019
- WordPress Registration Shortcodes List - August 14, 2018
- Advance WordPress User Login Plugin Guide - August 8, 2018
- WordPress User Registration Status Guide - April 9, 2018
- Create Intelligent Contact Form in WordPress [Breakthrough Ideas] - February 8, 2018
- Setup payments on Registration form using Products [Payments Guide] - December 22, 2017
- Create Your First WordPress Registration Page – Starter Guide - November 14, 2017
- How to Add Custom Fields to WooCommerce Checkout Form - November 3, 2017
- Setup Early Bird Registration for an Event on WordPress Site, with Ease! - April 20, 2017