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
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #32057
    digitaljoegeorge
    Participant

    Hello Ally,

    First and foremost, I have tried to input your code on this post: https://support.themecatcher.net/forums/topic/automatically-activate-and-login-user-after-register#post-30221:

    wp_signon(array(
    ‘user_login’ => $email,
    ‘user_password’ => $password,
    ‘remember’ => false
    ));

    to no avail.

    Let me walk you through my current setup.

    Here is my registration form: https://cubitize.com/appsumo/.
    Here is my login form: https://cubitize.com/login/.
    When someone registers or logins they are redirected to a PRIVATE page located here: https://cubitize.com/chatbot-instructions/.

    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 https://support.themecatcher.net/quform-wordpress-v2/guides/integration/creating-a-user to create a wordpress user along with this guide to create a login form: https://support.themecatcher.net/quform-wordpress-v2/guides/integration/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:

    https://prnt.sc/uxntn5

    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:

    https://prnt.sc/uxnzvy

    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: https://wpcodeus.com/gravity-forms-automatically-login-user/

    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?

    I WOULD SINCERELY APPRECIATE ANY ASSISTANCE YOU CAN PROVIDE AS I HAVE ALREADY LOST 3 HOURS WORTH OF MY TIME TRYING TO FIGURE OUT THIS DILEMMA!

    Thank you Ally for your generous and patient support!

    #32063
    Ally
    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