Make WordPress Core

Changeset 12983


Ignore:
Timestamp:
02/06/2010 06:20:38 AM (15 years ago)
Author:
dd32
Message:

Switch to *_user_option() for default password nag to avoid extra DB queries. Fixes #11380

Location:
trunk
Files:
3 edited

Legend:

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

    r12947 r12983  
    6565        $message = __('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.');
    6666        $user_id = wp_create_user($user_name, $random_password, $user_email);
    67         update_usermeta($user_id, 'default_password_nag', true);
     67        update_user_option($user_id, 'default_password_nag', true, true);
    6868    } else {
    6969        $random_password = '';
  • trunk/wp-admin/includes/user.php

    r12766 r12983  
    808808function default_password_nag_handler($errors = false) {
    809809    global $user_ID;
    810     if ( ! get_usermeta($user_ID, 'default_password_nag') ) //Short circuit it.
     810    if ( ! get_user_option('default_password_nag') ) //Short circuit it.
    811811        return;
    812812
     
    814814    if ( 'hide' == get_user_setting('default_password_nag') || isset($_GET['default_password_nag']) && '0' == $_GET['default_password_nag'] ) {
    815815        delete_user_setting('default_password_nag');
    816         update_usermeta($user_ID, 'default_password_nag', false);
     816        update_user_option($user_ID, 'default_password_nag', false, true);
    817817    }
    818818}
     
    821821function default_password_nag_edit_user($user_ID, $old_data) {
    822822    global $user_ID;
    823     if ( ! get_usermeta($user_ID, 'default_password_nag') ) //Short circuit it.
     823    if ( ! get_user_option('default_password_nag') ) //Short circuit it.
    824824        return;
    825825
     
    828828    if ( $new_data->user_pass != $old_data->user_pass ) { //Remove the nag if the password has been changed.
    829829        delete_user_setting('default_password_nag');
    830         update_usermeta($user_ID, 'default_password_nag', false);
     830        update_user_option($user_ID, 'default_password_nag', false, true);
    831831    }
    832832}
     
    834834add_action('admin_notices', 'default_password_nag');
    835835function default_password_nag() {
    836     global $user_ID;
    837     if ( ! get_usermeta($user_ID, 'default_password_nag') )
     836    if ( ! get_user_option('default_password_nag') ) //Short circuit it.
    838837        return;
    839838
  • trunk/wp-login.php

    r12981 r12983  
    243243
    244244    wp_set_password($new_pass, $user->ID);
    245     update_usermeta($user->ID, 'default_password_nag', true); //Set up the Password change nag.
     245    update_user_option($user_ID, 'default_password_nag', true, true); //Set up the Password change nag.
    246246    $message  = sprintf(__('Username: %s'), $user->user_login) . "\r\n";
    247247    $message .= sprintf(__('Password: %s'), $new_pass) . "\r\n";
Note: See TracChangeset for help on using the changeset viewer.