How do I convert users who put an email and username for a comment into registered users? [duplicate]

To achieve this, create a new page template and use this code in that file. Then, use your submit form to redirect the user after commenting to the new page.

$user_login = $_POST['user_login'];
$user_email = $_POST['user_email'];
$errors = register_new_user($user_login, $user_email);
if ( !is_wp_error($errors) ) {
    $redirect_to = !empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered';
    wp_safe_redirect( $redirect_to );

Note that user_login and user_email are the names of your form’s input boxes. The passwords will be randomly generated and sent to user’s email address.