WordPress.org

Make WordPress Core

Changeset 11326


Ignore:
Timestamp:
05/14/09 06:54:33 (5 years ago)
Author:
westi
Message:

Give better instructions when installing over an existing users table. Fixes #9569 based on patch from coffee2code.

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/upgrade.php

    r11323 r11326  
    2121if ( !function_exists('wp_install') ) : 
    2222/** 
    23  * {@internal Missing Short Description}} 
     23 * Installs the blog 
    2424 * 
    2525 * {@internal Missing Long Description}} 
     
    3232 * @param bool $public Whether blog is public. 
    3333 * @param null $deprecated Optional. Not used. 
    34  * @return array Array keys 'url', 'user_id', 'password'. 
     34 * @return array Array keys 'url', 'user_id', 'password', 'password_message'. 
    3535 */ 
    3636function wp_install($blog_title, $user_name, $user_email, $public, $deprecated='') { 
     
    6060    if ( !$user_id ) { 
    6161        $random_password = wp_generate_password(); 
     62        $message = __('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.'); 
    6263        $user_id = wp_create_user($user_name, $random_password, $user_email); 
    6364        update_usermeta($user_id, 'default_password_nag', true); 
    6465    } else { 
    65         $random_password = __('User already exists.  Password inherited.'); 
     66        $random_password = ''; 
     67        $message =  __('User already exists.  Password inherited.'); 
    6668    } 
    6769 
     
    7779    wp_cache_flush(); 
    7880 
    79     return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $random_password); 
     81    return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $random_password, 'password_message' => $message); 
    8082} 
    8183endif; 
  • trunk/wp-admin/install.php

    r11301 r11326  
    137137    <tr> 
    138138        <th><?php _e('Password'); ?></th> 
    139         <td><code><?php echo $password; ?></code><br /> 
    140             <?php echo '<p>'.__('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.').'</p>'; ?></td> 
     139        <td><?php if ( !empty( $password ) ) { 
     140                        echo '<code>'. $password .'</code><br />'; 
     141                    } 
     142                    echo '<p>'. $password_message .'</p>'; ?></td> 
    141143    </tr> 
    142144</table> 
Note: See TracChangeset for help on using the changeset viewer.