WordPress.org

Make WordPress Core

Changeset 11217


Ignore:
Timestamp:
05/06/2009 04:19:40 PM (13 years ago)
Author:
ryan
Message:

Default password nag fixes. Props DD32. fixes #9710

File:
1 edited

Legend:

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

    r11204 r11217  
    793793
    794794add_action('admin_init', 'default_password_nag_handler');
    795 function default_password_nag_handler() {
     795function default_password_nag_handler($errors = false) {
     796    global $user_ID;
     797    if ( ! get_usermeta($user_ID, 'default_password_nag') ) //Short circuit it.
     798        return;
     799
     800    //get_user_setting = JS saved UI setting. else no-js-falback code.
    796801    if ( 'hide' == get_user_setting('default_password_nag') || isset($_GET['default_password_nag']) && '0' == $_GET['default_password_nag'] ) {     
    797         global $user_ID;
    798802        delete_user_setting('default_password_nag');
    799803        update_usermeta($user_ID, 'default_password_nag', false);
    800804    }
    801805}
     806
     807add_action('profile_update', 'default_password_nag_edit_user', 10, 2);
     808function default_password_nag_edit_user($user_ID, $old_data) {
     809    global $user_ID;
     810    if ( ! get_usermeta($user_ID, 'default_password_nag') ) //Short circuit it.
     811        return;
     812
     813    $new_data = get_userdata($user_ID);
     814
     815    if ( $new_data->user_pass != $old_data->user_pass ) { //Remove the nag if the password has been changed.
     816        delete_user_setting('default_password_nag');
     817        update_usermeta($user_ID, 'default_password_nag', false);
     818    }
     819}
     820
    802821add_action('admin_notices', 'default_password_nag');
    803822function default_password_nag() {
Note: See TracChangeset for help on using the changeset viewer.