Please HELP: How To Create Autologin After Registration

Home Forums Quform WordPress Please HELP: How To Create Autologin After Registration

This topic is: not resolved
  • This topic has 1 reply, 2 voices, and was last updated 1 year ago by Ally.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #32057

    Hello Ally,

    First and foremost, I have tried to input your code on this post:

    ‘user_login’ => $email,
    ‘user_password’ => $password,
    ‘remember’ => false

    to no avail.

    Let me walk you through my current setup.

    Here is my registration form:
    Here is my login form:
    When someone registers or logins they are redirected to a PRIVATE page located here:

    I have already added special code to give subscriber roles the ability to view private pages. I have tested the code flawlessly by logging into the login page under a different email with subscriber privileges. No issues thank God. So I know my private page is viewable for admins, editors, and subscribers (only if the subscriber registers first on the registration page).

    I have already followed your guide to create a wordpress user along with this guide to create a login form:

    So all these snippets of code are inserted in my child theme. It is important to note I modified your create a user code as follows:

    I modified this code to the extent of excluding any references made to “username”. As such, I didn’t add the add_filter for username, add_action for username, and user_login => username. The reason I excluded the “username” keyword is because I only have an email and password field on both my registration and login page.

    As you can see from the screenshot above, for user_login => I replaced username with email.

    I then tested my changes thoroughly by first completing the registration form and then logging in using the login form. I noticed as soon as I register, a new user gets created in my WordPress dashboard with the subscriber privileges. Hooray. That takes care of the first step.

    I then noticed if I use the same credentials entered in the registration page on the login page, I am able to login without any issues. Perfecto so far…

    Now here is my issue….

    I am trying to automatically log in users after registration so that they wouldn’t redirect to the login page and have to reentertheir credentials again.

    When I use the wp_signon code above, I get nowhere. Here is where I have it currently:

    I then realized well maybe since I don’t have a username field in either forms, I need to replace ‘user_login’ => $username, with ‘user_login’ => $email;

    Still no luck…

    I then found an article on gravity forms here:

    Their code is a little different than yours. So I tried to use theirs instead. Still no luck. I then tirelessly tried different variations between your code and theirs as well as different positions (inserting the code before return $result under update_user_meta section or inserting it before update_user_meta section. Still no freaking damn success…

    At this stage, I am ripping my hair out.

    As a side note, following the gravity forms article I tried to use both the raw code and a modified version where I removed the “user_” parts mentioned in $user_login, $user_password. Still no avail…

    Also, for the record, your code shows ‘remember’ = true but I think it should be set to false since I don’t have a remember me checkbox on my registration form. Right?


    Thank you Ally for your generous and patient support!

    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2020 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy