1.20.x user.module user_file_move(File $file, File $source)

Implements hook_file_move().

File

modules/user/user.module, line 646
Enables the user registration and login system.

Code

function user_file_move(File $file, File $source) {
  // If a user's picture is replaced with a new one, update the record in
  // the users table.
  if (isset($file->fid) && isset($source->fid) && $file->fid != $source->fid) {
    db_update('users')
      ->fields(array(
        'picture' => $file->fid,
      ))
      ->condition('picture', $source->fid)
      ->execute();
  }
}