Skip Navigation

[Resolved] Automatic Login with Autogenerated login.

This support ticket is created 2 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 18 replies, has 2 voices.

Last updated by Minesh 2 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#2302071

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

It seems we cross-posted the reply. Can you please check my last reply and confirm auto-login works.

#2302085

My issue is resolved now. Thank you!

The above code works.

#2302173

I believe it was this line here you added. Is that correct?

remove_filter('pre_user_login','smyles_custom_username_seq_pre_user_login');

Many thanks. This project goes out to thousands of students in Brazil, tomorrow. You help has been outstanding.

#2302201

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

This is the code for without email - you should add within cred_save_data hook.

 // Login without email 
 
    if ( 1194 == $form_data['id'] ) {
 
        remove_filter('pre_user_login','smyles_custom_username_seq_pre_user_login');
 
        $my_username = smyles_generate_next_seq_user_login(); 
 
 
        if ( !empty( $_POST['user_pass'] ) ) {
 
 
 
            $newuser = get_user_by( "id", $new_user_id );
             
 
            $signon = array(
 
                'user_login'    => $newuser->data->user_login,
 
                'user_password' => $_POST['user_pass'],
 
                'remember'      => true
 
            );
 
    
 
            $login = wp_signon( $signon, false );
             
              
 
            if ( is_wp_error($login) ) {
 
                error_log( $login->get_error_message() );
 
            }
 
        }
 
    };

Thanks for your kind words and feedback, you are welcome to mark resolve this ticket.