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 '