diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index 8b76c7d34d..16897759ef 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -60,6 +60,7 @@ function wp_install($blog_title, $user_name, $user_email, $public, $deprecated=' if ( !$user_id ) { $random_password = wp_generate_password(); $user_id = wp_create_user($user_name, $random_password, $user_email); + update_usermeta($user_id, 'default_password_nag', true); } else { $random_password = __('User already exists. Password inherited.'); } diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php index 577bfe5592..652b70ce4d 100644 --- a/wp-admin/includes/user.php +++ b/wp-admin/includes/user.php @@ -791,4 +791,24 @@ class WP_User_Search { } endif; +add_action('admin_init', 'default_password_nag_handler'); +function default_password_nag_handler() { + if ( 'hide' == get_user_setting('default_password_nag') || isset($_GET['default_password_nag']) && '0' == $_GET['default_password_nag'] ) { + global $user_ID; + delete_user_setting('default_password_nag'); + update_usermeta($user_ID, 'default_password_nag', false); + } +} +add_action('admin_notices', 'default_password_nag'); +function default_password_nag() { + global $user_ID; + if ( ! get_usermeta($user_ID, 'default_password_nag') ) + return; + + echo '

'; + printf(__("Howdy, you're still using the auto-generated password for your account. We recommend that you change it to something you'll remember easier. Would you like to do this now?
+ Yes, Take me to my profile page | No Thanks, Do not remind me again."), admin_url('profile.php') . '#password', '?default_password_nag=0'); + echo '

'; +} + ?> diff --git a/wp-admin/js/common.dev.js b/wp-admin/js/common.dev.js index cb6112263e..19405fc277 100644 --- a/wp-admin/js/common.dev.js +++ b/wp-admin/js/common.dev.js @@ -232,6 +232,11 @@ jQuery(document).ready( function($) { return ''; }); }); + $('#default-password-nag-no').click( function() { + setUserSetting('default_password_nag', 'hide'); + $('div.default-password-nag').hide(); + return false; + }); }); (function(){ diff --git a/wp-admin/user-edit.php b/wp-admin/user-edit.php index 524ba31e76..a64a9f178a 100644 --- a/wp-admin/user-edit.php +++ b/wp-admin/user-edit.php @@ -353,7 +353,7 @@ else $show_password_fields = apply_filters('show_password_fields', true); if ( $show_password_fields ) : ?> - +

diff --git a/wp-login.php b/wp-login.php index c0ad46189d..6fda9bf1ae 100644 --- a/wp-login.php +++ b/wp-login.php @@ -179,6 +179,7 @@ function reset_password($key) { // Generate something random for a password... $new_pass = wp_generate_password(); wp_set_password($new_pass, $user->ID); + update_usermeta($user->ID, 'default_password_nag', true); //Set up the Password change nag. $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n"; $message .= sprintf(__('Password: %s'), $new_pass) . "\r\n"; $message .= site_url('wp-login.php', 'login') . "\r\n";