Auto create autologin link when user is created
-
hi!
Your auto login plugin is really great! It really helps me a lot.
I found this topic from 6 years ago but the code provided by @ngrudev no longer seems to work.
//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 ); }
Would it be possible to have a version of the code that works?
You should make a paid version to reward yourself for your efforts and offer some additional features.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Auto create autologin link when user is created’ is closed to new replies.