Displays the fields for the new user account registration form.
Parameters
Source
function show_user_form( $user_name = '', $user_email = '', $errors = '' ) {
if ( ! is_wp_error( $errors ) ) {
$errors = new WP_Error();
}
// Username.
echo '<label for="user_name">' . __( 'Username:' ) . '</label>';
$errmsg_username = $errors->get_error_message( 'user_name' );
$errmsg_username_aria = '';
if ( $errmsg_username ) {
$errmsg_username_aria = 'wp-signup-username-error ';
echo '<p class="error" id="wp-signup-username-error">' . $errmsg_username . '</p>';
}
?>
<input name="user_name" type="text" id="user_name" value="<?php echo esc_attr( $user_name ); ?>" autocapitalize="none" autocorrect="off" maxlength="60" autocomplete="username" required="required" aria-describedby="<?php echo $errmsg_username_aria; ?>wp-signup-username-description" />
<p id="wp-signup-username-description"><?php _e( '(Must be at least 4 characters, lowercase letters and numbers only.)' ); ?></p>
<?php
// Email address.
echo '<label for="user_email">' . __( 'Email Address:' ) . '</label>';
$errmsg_email = $errors->get_error_message( 'user_email' );
$errmsg_email_aria = '';
if ( $errmsg_email ) {
$errmsg_email_aria = 'wp-signup-email-error ';
echo '<p class="error" id="wp-signup-email-error">' . $errmsg_email . '</p>';
}
?>
<input name="user_email" type="email" id="user_email" value="<?php echo esc_attr( $user_email ); ?>" maxlength="200" autocomplete="email" required="required" aria-describedby="<?php echo $errmsg_email_aria; ?>wp-signup-email-description" />
<p id="wp-signup-email-description"><?php _e( 'Your registration email is sent to this address. (Double-check your email address before continuing.)' ); ?></p>
<?php
// Extra fields.
$errmsg_generic = $errors->get_error_message( 'generic' );
if ( $errmsg_generic ) {
echo '<p class="error" id="wp-signup-generic-error">' . $errmsg_generic . '</p>';
}
/**
* Fires at the end of the new user account registration form.
*
* @since 3.0.0
*
* @param WP_Error $errors A WP_Error object containing 'user_name' or 'user_email' errors.
*/
do_action( 'signup_extra_fields', $errors );
}
Hooks
- do_action( ‘signup_extra_fields’,
WP_Error $errors ) Fires at the end of the new user account registration form.
Changelog
Version | Description |
---|---|
MU (3.0.0) | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.