I want to convert all anonymous comments that have already been posted into a registered user using the username and a randomly generated password.
I really don't know where to begin with this.
I also want to convert new anonymous commenters into a registered user. If I add a hook into functions.php using register_new_user will it automatically generate a random password for the user and email them, or do I need to make a password field under the comment form as well?
Here is my comment form when a user is not registered:
Here is what my code for the comment form looks like:
args = array( 'comment_field' => '<div class="form-group the-comment-form"><label for="comment" class="custom-avatar">' . $useravatar_custom . '</label><div id="' . $textareaId . '"><textarea id="comment" class="form-control" name="comment" cols="45" rows="8" aria-required="true" placeholder="Join the discussion..."></textarea></div></div>', 'fields' => apply_filters( 'comment_form_default_fields', array( 'author' => '<div class="form-group comments-name">' . '<label for="author">' . __( 'Username', 'usertheme' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input id="author" name="author" class="form-control" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></div>', 'email' => '<div class="form-group comments-email"><label for="email">' . __( 'Email', 'usertheme' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input id="email" name="email" class="form-control" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></div>' As you see, there is a name and email required. What I want to do is make it register a new user. But I also want to generate a random password for the user.
Do I need to add a password field to the comment form? Or do I need to use the wordpress create password function? Or if I use register_new_user will it automatically generate a random password and email the user their new login details?
