0

For my registration I am using custom registration form.It works fine.It sends email with username and password.

What I am looking I want to generate url so that when user click it automatically complete activation .I do not want them to write username or password manually.My code for sending email

                $random_password = wp_generate_password( 12, false );
            $status = wp_create_user( $username, $random_password, $email );
            if ( is_wp_error($status) ) 
                echo "Username already exists. Please try another one.";
            else {
                $from = get_option('admin_email');
                $headers = 'From: '.$from . "\r\n";
                $subject = "Registration successful";
                $msg = "Registration successful.\nYour login details\nUsername: $username\nPassword: $random_password";
                wp_mail( $email, $subject, $msg, $headers );

                echo "Please check your email for login details.";
            }
0

I think similar question is answered here:

Send user activation email when programmatically creating user

Please have a look.

Let me know if that solves the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.