--- avatar_selection.module 26 Jul 2007 09:36:22 -0000 1.1.2.17 +++ avatar_selection.module 27 Jul 2007 15:36:56 -0000 @@ -1,5 +1,5 @@ 'radios', @@ -375,6 +375,7 @@ } elseif ($step == "edit") { + $form['#redirect'] = array('admin/settings/avatar_selection/edit'); $roles = avatar_selection_handler_filter_role(); $result = db_query("SELECT avatar, access FROM {avatar_selection} avs WHERE avatar = '%s'", $form_values['select_avatar']); @@ -518,24 +519,17 @@ } elseif ($op == t('Delete')) { - foreach ($form_values['images'] as $path => $is_removed) { - if ($is_removed) { - $to_delete[] = $path; - } - } - if (is_array($to_delete)) { - avatar_selection_image_delete($to_delete); - } + $image = $form_values['select_avatar']; + avatar_selection_image_delete($image); } } -function avatar_selection_image_delete($to_delete) { - foreach ($to_delete as $path) { - if (file_check_location($path, file_create_path('avatar_selection'))) { - file_delete($path); - if (!image_get_info($path)) { - drupal_set_message(t('Image deleted.')); - } +function avatar_selection_image_delete($image) { + if (file_check_location($image, file_create_path('avatar_selection'))) { + $result = db_query("DELETE FROM {avatar_selection} WHERE avatar = '%s'", $image); + file_delete($image); + if (!image_get_info($image)) { + drupal_set_message(t('Image deleted.')); } } }