Skip Navigation

[Résolu] Automatic Login with Autogenerated login.

This support ticket is created Il y a 2 années et 9 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

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)

Ce sujet contient 18 réponses, a 2 voix.

Dernière mise à jour par Minesh Il y a 2 années et 9 mois.

Assisté par: Minesh.

Auteur
Publications
#2302071

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: 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

Les langues: Anglais (English )

Fuseau horaire: 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.