default_password_nag_edit_user

The WordPress Core default password nag edit user function.

Description

default_password_nag_edit_user( (int) $user_ID, (object) $old_data ); 

Parameters (2)

0. $user_id (int)
The user id.
1. $old_data (object)
The old data.

Usage

  1. if ( !function_exists( 'default_password_nag_edit_user' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/user.php'; 
  3.  
  4. // The user id. 
  5. $user_id = -1; 
  6.  
  7. // The old data. 
  8. $old_data = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = default_password_nag_edit_user($user_id, $old_data); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/user.php  
  1. function default_password_nag_edit_user($user_ID, $old_data) { 
  2. // Short-circuit it. 
  3. if ( ! get_user_option('default_password_nag', $user_ID) ) 
  4. return; 
  5.  
  6. $new_data = get_userdata($user_ID); 
  7.  
  8. // Remove the nag if the password has been changed. 
  9. if ( $new_data->user_pass != $old_data->user_pass ) { 
  10. delete_user_setting('default_password_nag'); 
  11. update_user_option($user_ID, 'default_password_nag', false, true);