Index: avatar_selection.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/avatar_selection/avatar_selection.module,v retrieving revision 1.1.2.22.2.16 diff -u -r1.1.2.22.2.16 avatar_selection.module --- avatar_selection.module 19 Feb 2008 17:54:48 -0000 1.1.2.22.2.16 +++ avatar_selection.module 27 Feb 2008 12:43:17 -0000 @@ -280,6 +280,11 @@ $file = file_save_upload('picture_upload', $validators); if ($file) { + // Remove the old picture. + if (isset($form_state['values']['_account']->picture) && file_exists($form_state['values']['_account']->picture)) { + file_delete($form_state['values']['_account']->picture); + } + // The image was saved using file_save_upload() and was added to the // files table as a temporary file. We'll make a copy and let the // garbage collector delete the original upload. @@ -762,6 +767,7 @@ if ($file = file_save_upload('picture_upload', $validators, $dir, FILE_EXISTS_RENAME)) { if (image_get_info($file->filepath)) { + file_set_status($file, FILE_STATUS_PERMANENT); $og = ''; $access = implode(', ', array_keys(array_filter($form_state['values']['access']))); if (module_exists("og")) {