PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Automatic login

  1. Hello!

    I know there are several post about this, but none of them have helped me. I simply want to auto login users after they have submitted a user registration form.

    I see that a number of people are using this code, but its not working:

    add_action( 'gform_user_registered', 'pi_gravity_registration_autologin', 10, 4 );
    02
    /**
    03
     * Auto login after registration.
    04
     */
    05
    function pi_gravity_registration_autologin( $user_id, $user_config, $entry, $password ) {
    06
        $user = get_userdata( $user_id );
    07
        $user_login = $user->user_login;
    08
        $user_password = $password;
    09
    
    10
        wp_signon( array(
    11
            'user_login' => $user_login,
    12
            'user_password' =>  $user_password,
    13
            'remember' => false
    14
        ) );
    15
    }

    I added the above code at the end of my functions.php. Is there anything else thats needs to be done?

    All that happened when I added the code was my login got broke. When I go to domain.com/wp-login.php and enter user and password and hit login, I just come to a blank page.

    Any input would be lovely.

    Posted 11 years ago on Wednesday April 24, 2013 | Permalink
  2. David Peralty

    Can you copy and paste your functions.php file to pastebin and link to the page here so we can take a look? This code shouldn't effect wp-login.php at all.

    Posted 11 years ago on Wednesday April 24, 2013 | Permalink