From 68ced8da595a90abfcda774a1bffddb65ec588e5 Mon Sep 17 00:00:00 2001 From: Dries Buytaert <dries@buytaert.net> Date: Sun, 8 Jan 2006 12:06:13 +0000 Subject: [PATCH] - Patch #24678 by jmengle, DriesK, Richard et al: bugfix: deleting a profile field doesn't delete values in profile_values table. --- modules/profile.module | 10 +++++++--- modules/profile/profile.module | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/modules/profile.module b/modules/profile.module index 6db0b30687a5..fe631a568a5e 100644 --- a/modules/profile.module +++ b/modules/profile.module @@ -551,14 +551,18 @@ function profile_admin_delete($fid) { $field = db_fetch_object(db_query("SELECT title FROM {profile_fields} WHERE fid = %d", $fid)); if ($_POST['edit']['confirm']) { db_query('DELETE FROM {profile_fields} WHERE fid = %d', $fid); + db_query('DELETE FROM {profile_values} WHERE fid = %d', $fid); cache_clear_all(); drupal_set_message(t('The field %field has been deleted.', array('%field' => theme('placeholder', $field->title)))); drupal_goto('admin/settings/profile'); } else { - return confirm_form('profile_confirm_delete', $form, t('Do you want to remove the field %field?', - array('%field' => $field->title)), - 'admin/settings/profile', '', t('Delete'), t('Cancel')); + return confirm_form('profile_confirm_delete', $form, + t('Are you sure you want to delete the field %field?', array('%field' => theme('placeholder', $field->title))), + 'admin/settings/profile', + t('This action cannot be undone. If users have entered values into this field in their profile, these entries will also be deleted. If you want to keep the user-entered data, instead of deleting the field you may wish to <a href="%edit-field">edit this field</a> and change it to a \'hidden profile field\' so that it may only be accessed by administrators.', array('%edit-field' => url('admin/settings/profile/edit/' . $fid))), + t('Delete'), + t('Cancel')); } } diff --git a/modules/profile/profile.module b/modules/profile/profile.module index 6db0b30687a5..fe631a568a5e 100644 --- a/modules/profile/profile.module +++ b/modules/profile/profile.module @@ -551,14 +551,18 @@ function profile_admin_delete($fid) { $field = db_fetch_object(db_query("SELECT title FROM {profile_fields} WHERE fid = %d", $fid)); if ($_POST['edit']['confirm']) { db_query('DELETE FROM {profile_fields} WHERE fid = %d', $fid); + db_query('DELETE FROM {profile_values} WHERE fid = %d', $fid); cache_clear_all(); drupal_set_message(t('The field %field has been deleted.', array('%field' => theme('placeholder', $field->title)))); drupal_goto('admin/settings/profile'); } else { - return confirm_form('profile_confirm_delete', $form, t('Do you want to remove the field %field?', - array('%field' => $field->title)), - 'admin/settings/profile', '', t('Delete'), t('Cancel')); + return confirm_form('profile_confirm_delete', $form, + t('Are you sure you want to delete the field %field?', array('%field' => theme('placeholder', $field->title))), + 'admin/settings/profile', + t('This action cannot be undone. If users have entered values into this field in their profile, these entries will also be deleted. If you want to keep the user-entered data, instead of deleting the field you may wish to <a href="%edit-field">edit this field</a> and change it to a \'hidden profile field\' so that it may only be accessed by administrators.', array('%edit-field' => url('admin/settings/profile/edit/' . $fid))), + t('Delete'), + t('Cancel')); } } -- GitLab