diff --git a/plugins/cipf_plugin/php/profs_handle_states.php b/plugins/cipf_plugin/php/profs_handle_states.php index 59e1dcf..5dec396 100644 --- a/plugins/cipf_plugin/php/profs_handle_states.php +++ b/plugins/cipf_plugin/php/profs_handle_states.php @@ -127,7 +127,11 @@ function handle_prof_account_deletion_CIPF($user_id) { wp_delete_user($user_id); } -function prof_deletion_images_CIPF($user_id, $reassign, $user) { +/* +* it should not be necessary, but just in case +* +*/ +function prof_deletion_ensure_images_are_deleted_CIPF($user_id, $reassign, $user) { Plgntls::debug_infos(); $role_prof = Cipf::ROLE_PROF; @@ -146,20 +150,17 @@ function prof_deletion_images_CIPF($user_id, $reassign, $user) { } foreach ($images as $image) { $image_id = $image->ID; - // dont delete, for log - error_log('- delete image: ' . $image_id); // Set the second argument to true to permanently delete the attachment - // $result = wp_delete_attachment($image_id, true); - // if ($result === false) { - // error_log('Failed to delete image with ID ' . $image_id); - // } - // else { - // error_log('Image with ID ' . $image_id . ' deleted successfully'); - // } + $result = wp_delete_attachment($image_id, true); + if ($result === false) { + error_log('- failed to delete image: ' . $image_id); + } + else { + error_log('- delete image: ' . $image_id); + } } - } -add_action('deleted_user', 'prof_deletion_images_CIPF', 10, 3); +add_action('deleted_user', 'prof_deletion_ensure_images_are_deleted_CIPF', 10, 3);