Auto Login User After Registration on WordPress Site  

Blog

Auto Login User After Registration

Auto login user after registration on WordPress site

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.

Auto login user after registration - 1

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:

Auto login user after registration - 2

On an existing registration form, this option looks like this:

Auto login user after registration - 3

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 after registration - 4

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.

Auto login user after registration - 5

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.

Auto login user after registration - 6

We’re are all set now. Let’s test it out. To start with, here’s our form. Nothing fancy.

Auto login user after registration - 7

Testing submission – auto login user after registration 

Filling it out now:

Auto login user after registration - 8

Submission successful. Notice the redirection message:

Auto login user after registration - 9

And… in another moment we are at the My Account page logged in as expected.

Auto login user after registration - 10

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…

Leave a Comment

Your email address will not be published. Required fields are marked *

shares