Send autologin link on registration email
-
Hi,
I’ve started using this plugin, auto login links works like a charm.
I’ve also included on my functions.php the following code, in order to generate the auto-login link on user creation.//generate autologin links for registeret users function generateRandomString($length = 60) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $charactersLength = strlen($characters); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } return $randomString; } add_action( 'user_register', 'myplugin_registration_save', 10, 1 ); function myplugin_registration_save( $user_id , $length ) { $meta_key = "pkg_autologin_code"; $timestampz=time(); $tokenparta = generateRandomString(); $key = $timestampz*3 . $tokenparta; update_user_meta( $user_id, $meta_key, $key ); }
What I need now, is the ability to send the autologin link on the user registration automatic email, so the user will be able to follow that link and automatically sign in on the website.
How can we adapt this code to to this?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Send autologin link on registration email’ is closed to new replies.