automatically activate and login user after register

Home Forums Quform WordPress automatically activate and login user after register

This topic is: resolved
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #30201
    jennis015
    Participant

    HI! I wanted to automatically activate and login user after registration on my site using quform is there a way? now i have create the user with this code and it appear like pending user and not logged in.

    add_action('quform_post_process_5', function (array $result, Quform_Form $form) {
        if (function_exists('bp_core_signup_user')) {
            $username = $form->getValueText('quform_5_44');
            $email = $form->getValueText('quform_5_44');
             $password = $form->getValueText('quform_5_16');
            // Profile fields
            $usermeta = array(
                 'field_1' => $form->getValueText('quform_5_16'),
                 'field_43' => $form->getValueText('quform_5_44'),      
           );
     
            $usermeta['profile_field_ids'] = '1,43';
            $usermeta['password'] = wp_hash_password($password);
    
            bp_core_signup_user($username, $password, $email, $usermeta);
        }
        return $result;
    }, 10, 2);

    `

    #30221
    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.

    #30225
    jennis015
    Participant

    Hi ally
    i added this after the code of registration:

    add_filter('quform_post_process_5', function (array $result, Quform_Form $form) {
       wp_signon(array(
        'user_login' => $username,
        'user_password' => $password,
        'remember' => true
    ), false);
     
        return $result;
    }, 10, 2); 

    but itsnt works. something is wrong? thanks!

    #30226
    jennis015
    Participant

    Solved!! thanks!

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