display_setup_form

Display installer setup form.

Description

display_setup_form( (null) $error = null ); 

Parameters (1)

0. $error — Optional. (null) => null
The error.

Usage

  1. if ( !function_exists( 'display_setup_form' ) ) { 
  2. require_once ABSPATH . '/wp-admin/install.php'; 
  3.  
  4. // The error. 
  5. $error = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = display_setup_form($error); 
  9.  

Defined (1)

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

/wp-admin/install.php  
  1. function display_setup_form( $error = null ) { 
  2. global $wpdb; 
  3.  
  4. $sql = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $wpdb->users ) ); 
  5. $user_table = ( $wpdb->get_var( $sql ) != null ); 
  6.  
  7. // Ensure that Blogs appear in search engines by default. 
  8. $blog_public = 1; 
  9. if ( isset( $_POST['weblog_title'] ) ) { 
  10. $blog_public = isset( $_POST['blog_public'] ); 
  11.  
  12. $weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : ''; 
  13. $user_name = isset($_POST['user_name']) ? trim( wp_unslash( $_POST['user_name'] ) ) : ''; 
  14. $admin_email = isset( $_POST['admin_email'] ) ? trim( wp_unslash( $_POST['admin_email'] ) ) : ''; 
  15.  
  16. if ( ! is_null( $error ) ) { 
  17. ?> 
  18. <h1><?php _ex( 'Welcome', 'Howdy' ); ?></h1> 
  19. <p class="message"><?php echo $error; ?></p> 
  20. <?php } ?> 
  21. <form id="setup" method="post" action="install.php?step=2" novalidate="novalidate"> 
  22. <table class="form-table"> 
  23. <tr> 
  24. <th scope="row"><label for="weblog_title"><?php _e( 'Site Title' ); ?></label></th> 
  25. <td><input name="weblog_title" type="text" id="weblog_title" size="25" value="<?php echo esc_attr( $weblog_title ); ?>" /></td> 
  26. </tr> 
  27. <tr> 
  28. <th scope="row"><label for="user_login"><?php _e('Username'); ?></label></th> 
  29. <td> 
  30. <?php 
  31. if ( $user_table ) { 
  32. _e('User(s) already exists.'); 
  33. echo '<input name="user_name" type="hidden" value="admin" />'; 
  34. } else { 
  35. ?><input name="user_name" type="text" id="user_login" size="25" value="<?php echo esc_attr( sanitize_user( $user_name, true ) ); ?>" /> 
  36. <p><?php _e( 'Usernames can have only alphanumeric characters, spaces, underscores, hyphens, periods, and the @ symbol.' ); ?></p> 
  37. <?php 
  38. } ?> 
  39. </td> 
  40. </tr> 
  41. <?php if ( ! $user_table ) : ?> 
  42. <tr class="form-field form-required user-pass1-wrap"> 
  43. <th scope="row"> 
  44. <label for="pass1"> 
  45. <?php _e( 'Password' ); ?> 
  46. </label> 
  47. </th> 
  48. <td> 
  49. <div class=""> 
  50. <?php $initial_password = isset( $_POST['admin_password'] ) ? stripslashes( $_POST['admin_password'] ) : wp_generate_password( 18 ); ?> 
  51. <input type="password" name="admin_password" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" aria-describedby="pass-strength-result" /> 
  52. <button type="button" class="button wp-hide-pw hide-if-no-js" data-start-masked="<?php echo (int) isset( $_POST['admin_password'] ); ?>" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>"> 
  53. <span class="dashicons dashicons-hidden"></span> 
  54. <span class="text"><?php _e( 'Hide' ); ?></span> 
  55. </button> 
  56. <div id="pass-strength-result" aria-live="polite"></div> 
  57. </div> 
  58. <p><span class="description important hide-if-no-js"> 
  59. <strong><?php _e( 'Important:' ); ?></strong> 
  60. <?php /** translators: The non-breaking space prevents 1Password from thinking the text "log in" should trigger a password save prompt. */ ?> 
  61. <?php _e( 'You will need this password to log in. Please store it in a secure location.' ); ?></span></p> 
  62. </td> 
  63. </tr> 
  64. <tr class="form-field form-required user-pass2-wrap hide-if-js"> 
  65. <th scope="row"> 
  66. <label for="pass2"><?php _e( 'Repeat Password' ); ?> 
  67. <span class="description"><?php _e( '(required)' ); ?></span> 
  68. </label> 
  69. </th> 
  70. <td> 
  71. <input name="admin_password2" type="password" id="pass2" autocomplete="off" /> 
  72. </td> 
  73. </tr> 
  74. <tr class="pw-weak"> 
  75. <th scope="row"><?php _e( 'Confirm Password' ); ?></th> 
  76. <td> 
  77. <label> 
  78. <input type="checkbox" name="pw_weak" class="pw-checkbox" /> 
  79. <?php _e( 'Confirm use of weak password' ); ?> 
  80. </label> 
  81. </td> 
  82. </tr> 
  83. <?php endif; ?> 
  84. <tr> 
  85. <th scope="row"><label for="admin_email"><?php _e( 'Your Email' ); ?></label></th> 
  86. <td><input name="admin_email" type="email" id="admin_email" size="25" value="<?php echo esc_attr( $admin_email ); ?>" /> 
  87. <p><?php _e( 'Double-check your email address before continuing.' ); ?></p></td> 
  88. </tr> 
  89. <tr> 
  90. <th scope="row"><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?></th> 
  91. <td> 
  92. <fieldset> 
  93. <legend class="screen-reader-text"><span><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?> </span></legend> 
  94. <?php 
  95. if ( has_action( 'blog_privacy_selector' ) ) { ?> 
  96. <input id="blog-public" type="radio" name="blog_public" value="1" <?php checked( 1, $blog_public ); ?> /> 
  97. <label for="blog-public"><?php _e( 'Allow search engines to index this site' );?></label><br/> 
  98. <input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked( 0, $blog_public ); ?> /> 
  99. <label for="blog-norobots"><?php _e( 'Discourage search engines from indexing this site' ); ?></label> 
  100. <p class="description"><?php _e( 'Note: Neither of these options blocks access to your site — it is up to search engines to honor your request.' ); ?></p> 
  101. <?php 
  102. /** This action is documented in wp-admin/options-reading.php */ 
  103. } else { ?> 
  104. <label for="blog_public"><input name="blog_public" type="checkbox" id="blog_public" value="0" <?php checked( 0, $blog_public ); ?> /> 
  105. <?php _e( 'Discourage search engines from indexing this site' ); ?></label> 
  106. <p class="description"><?php _e( 'It is up to search engines to honor this request.' ); ?></p> 
  107. <?php } ?> 
  108. </fieldset> 
  109. </td> 
  110. </tr> 
  111. </table> 
  112. <p class="step"><?php submit_button( __( 'Install WordPress' ), 'large', 'Submit', false, array( 'id' => 'submit' ) ); ?></p> 
  113. <input type="hidden" name="language" value="<?php echo isset( $_REQUEST['language'] ) ? esc_attr( $_REQUEST['language'] ) : ''; ?>" /> 
  114. </form> 
  115. <?php