show_user_form

Display user registration form.

Description

show_user_form( (string) $user_name = '', (string) $user_email = '', (string) $errors = '' ); 

Parameters (3)

0. $user_name — Optional. (string) => ''
The entered username.
1. $user_email — Optional. (string) => ''
The entered email address.
2. $errors — Optional. (string) => ''
A WP_Error object containing existing errors. Defaults to empty string.

Usage

  1. if ( !function_exists( 'show_user_form' ) ) { 
  2. require_once '/wp-signup.php'; 
  3.  
  4. // The entered username. 
  5. $user_name = ''; 
  6.  
  7. // The entered email address. 
  8. $user_email = ''; 
  9.  
  10. // A WP_Error object containing existing errors. Defaults to empty string. 
  11. $errors = ''; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = show_user_form($user_name, $user_email, $errors); 
  15.  

Defined (1)

The function is defined in the following location(s).

/wp-signup.php  
  1. function show_user_form($user_name = '', $user_email = '', $errors = '') { 
  2. if ( ! is_wp_error( $errors ) ) { 
  3. $errors = new WP_Error(); 
  4.  
  5. // User name 
  6. echo '<label for="user_name">' . __('Username:') . '</label>'; 
  7. if ( $errmsg = $errors->get_error_message('user_name') ) { 
  8. echo '<p class="error">'.$errmsg.'</p>'; 
  9. echo '<input name="user_name" type="text" id="user_name" value="'. esc_attr( $user_name ) .'" autocapitalize="none" autocorrect="off" maxlength="60" /><br />'; 
  10. _e( '(Must be at least 4 characters, letters and numbers only.)' ); 
  11. ?> 
  12.  
  13. <label for="user_email"><?php _e( 'Email Address:' ) ?></label> 
  14. <?php if ( $errmsg = $errors->get_error_message('user_email') ) { ?> 
  15. <p class="error"><?php echo $errmsg ?></p> 
  16. <?php } ?> 
  17. <input name="user_email" type="email" id="user_email" value="<?php echo esc_attr($user_email) ?>" maxlength="200" /><br /><?php _e('We send your registration email to this address. (Double-check your email address before continuing.)') ?> 
  18. <?php 
  19. if ( $errmsg = $errors->get_error_message('generic') ) { 
  20. echo '<p class="error">' . $errmsg . '</p>'; 
  21. /** 
  22. * Fires at the end of the user registration form on the site sign-up form. 
  23. * @since 3.0.0 
  24. * @param WP_Error $errors A WP_Error object containing containing 'user_name' or 'user_email' errors. 
  25. */