• About WordPress
    • About WordPress
    • WordPress.org
    • Documentation
    • Support
    • Feedback
  • Log In
  • Register
WordPress.org
WordPress.org
  • Plugins
  • Themes
  • Patterns
  • Learn
  • Support
    • Documentation
    • Forums
  • News
  • About
  • Get Involved
    • Five for the Future
  • Showcase
  • Mobile
  • Hosting
  • Openverse
  • Get WordPress
Get WordPress

Code Reference

Skip to content
Filter by type:
Search
Browse: Home / Reference / Functions / show_user_form()

show_user_form( string $user_name = '', string $user_email = '', WP_Error|string $errors = '' )

Displays the fields for the new user account registration form.

Contents

  • Parameters
  • Source
  • Related
    • Uses
    • Used By
  • Changelog
  • User Contributed Notes

Parameters

$user_name

(string) (Optional) The entered username.

Default value: ''

$user_email

(string) (Optional) The entered email address.

Default value: ''

$errors

(WP_Error|string) (Optional) A WP_Error object containing existing errors. Defaults to empty string.

Default value: ''


Top ↑

Source

File: wp-signup.php

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 = $errors->get_error_message( 'user_name' );
	if ( $errmsg ) {
		echo '<p class="error">' . $errmsg . '</p>';
	}
	echo '<input name="user_name" type="text" id="user_name" value="' . esc_attr( $user_name ) . '" autocapitalize="none" autocorrect="off" maxlength="60" autocomplete="username" /><br />';
	_e( '(Must be at least 4 characters, letters and numbers only.)' );
	?>

	<label for="user_email"><?php _e( 'Email&nbsp;Address:' ); ?></label>
	<?php
	$errmsg = $errors->get_error_message( 'user_email' );
	if ( $errmsg ) {
		?>
		<p class="error"><?php echo $errmsg; ?></p>
	<?php } ?>
	<input name="user_email" type="email" id="user_email" value="<?php echo esc_attr( $user_email ); ?>" maxlength="200" autocomplete="email" /><br /><?php _e( 'Your registration email is sent to this address. (Double-check your email address before continuing.)' ); ?>
	<?php
	$errmsg = $errors->get_error_message( 'generic' );
	if ( $errmsg ) {
		echo '<p class="error">' . $errmsg . '</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 );
}

Expand full source code Collapse full source code View on Trac View on GitHub


Top ↑

Related

Top ↑

Uses

Uses
Uses Description
wp-signup.php: signup_extra_fields

Fires at the end of the new user account registration form.

wp-includes/l10n.php: __()

Retrieve the translation of $text.

wp-includes/l10n.php: _e()

Display translated text.

wp-includes/formatting.php: esc_attr()

Escaping for HTML attributes.

wp-includes/plugin.php: do_action()

Calls the callback functions that have been added to an action hook.

wp-includes/load.php: is_wp_error()

Checks whether the given variable is a WordPress Error.

wp-includes/class-wp-error.php: WP_Error::__construct()

Initializes the error.

Show 2 more uses Hide more uses

Top ↑

Used By

Used By
Used By Description
wp-signup.php: signup_user()

Shows a form for a visitor to sign up for a new user account.


Top ↑

Changelog

Changelog
Version Description
MU (3.0.0) Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.

  • About
  • News
  • Hosting
  • Donate
  • Support
  • Developers
  • Get Involved
  • Learn
  • Showcase
  • Plugins
  • Themes
  • Patterns
  • WordCamp
  • WordPress.TV
  • BuddyPress
  • bbPress
  • WordPress.com
  • Matt
  • Privacy
  • Public Code
WordPress.org
WordPress.org
  • Visit our Facebook page
  • Visit our Twitter account
Code is Poetry

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.