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…
- RegistrationMagic Starter Guide - August 4, 2024
- WordPress Registration Shortcodes List - July 10, 2024
- WordPress Payment Form Guide: Setup Payments on Registration Form - July 8, 2024
- 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
- WordPress User Registration Custom 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
Everything works until I attempt to login the user. Please advise.
Hi Derrick,
Could you please create a support ticket from here – https://metagauss.com/technical-support/
Our support team will help you with the issue.
What if someone who is already logged in comes to the registration page. Will the user see the registration form still (which would not make sense, I think), or would he or she be redirected to an account page, for example
Has this been answered somewhere ?
I have the same (presale) question.
User will be able to see and submit registration form while in logged-in state. In logged-in state, email field will display pre-populated with registered user email address, and form will be of contact type. It means on submission while the form data will get saved to database, the account itself won’t be created.