Ticket #10396: 10396.diff

File 10396.diff, 2.4 KB (added by dcole07, 3 years ago)

Basic Picking of default user name.

  • wp-admin/install.php

     
    6060                        <td><input name="weblog_title" type="text" id="weblog_title" size="25" value="<?php echo ( isset($_POST['weblog_title']) ? esc_attr($_POST['weblog_title']) : '' ); ?>" /></td> 
    6161                </tr> 
    6262                <tr> 
     63                        <th scope="row"><label for="user_name"><?php _e('User Name'); ?></label></th> 
     64                        <td><input name="user_name" type="text" id="user_name" size="25" value="<?php echo ( isset($_POST['user_name']) ? esc_attr($_POST['user_name']) : '' ); ?>" /></td> 
     65                </tr> 
     66                <tr> 
    6367                        <th scope="row"><label for="admin_email"><?php _e('Your E-mail'); ?></label></th> 
    6468                        <td><input name="admin_email" type="text" id="admin_email" size="25" value="<?php echo ( isset($_POST['admin_email']) ? esc_attr($_POST['admin_email']) : '' ); ?>" /><br /> 
    6569                        <?php _e('Double-check your email address before continuing.'); ?> 
     
    100104                display_header(); 
    101105                // Fill in the data we gathered 
    102106                $weblog_title = isset($_POST['weblog_title']) ? stripslashes($_POST['weblog_title']) : ''; 
     107                $user_name = isset($_POST['user_name']) ? stripslashes($_POST['user_name']) : ''; 
    103108                $admin_email = isset($_POST['admin_email']) ? stripslashes($_POST['admin_email']) : ''; 
    104109                $public = isset($_POST['blog_public']) ? (int) $_POST['blog_public'] : 0; 
    105110                // check e-mail address 
     
    108113                        // TODO: poka-yoke 
    109114                        display_setup_form( __('you must provide an e-mail address.') ); 
    110115                        $error = true; 
     116                } else if (empty($user_name)) { 
     117                        // TODO: poka-yoke 
     118                        display_setup_form( __('you must provide a valid user name.') ); 
     119                        $error = true; 
    111120                } else if (!is_email($admin_email)) { 
    112121                        // TODO: poka-yoke 
    113122                        display_setup_form( __('that isn&#8217;t a valid e-mail address.  E-mail addresses look like: <code>username@example.com</code>') ); 
     
    116125 
    117126                if ( $error === false ) { 
    118127                        $wpdb->show_errors(); 
    119                         $result = wp_install($weblog_title, 'admin', $admin_email, $public); 
     128                        $result = wp_install($weblog_title, $user_name, $admin_email, $public); 
    120129                        extract($result, EXTR_SKIP); 
    121130?> 
    122131 
     
    127136<table class="form-table"> 
    128137        <tr> 
    129138                <th><?php _e('Username'); ?></th> 
    130                 <td><code>admin</code></td> 
     139                <td><code><?php echo $user_name; ?></code></td> 
    131140        </tr> 
    132141        <tr> 
    133142                <th><?php _e('Password'); ?></th>