From 4d80b374e998bd0370f7730d2a4cd40bf1c3cab7 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 1 May 2005 09:41:23 +0000 Subject: - Modified patch #21617 by Robin: added confirmation screen to delete profile fields. (I tidied up the coding style and fixed two typos.) --- modules/profile/profile.module | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'modules/profile/profile.module') diff --git a/modules/profile/profile.module b/modules/profile/profile.module index 91a5896f5..64ae47fb4 100644 --- a/modules/profile/profile.module +++ b/modules/profile/profile.module @@ -558,12 +558,20 @@ function profile_admin_edit($fid) { * Menu callback; deletes a field from all user profiles. */ function profile_admin_delete($fid) { - db_query('DELETE FROM {profile_fields} WHERE fid = %d', $fid); - - cache_clear_all(); - - drupal_set_message(t('The field has been deleted.')); - drupal_goto('admin/settings/profile'); + $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); + 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 { + $output = theme('confirm', + t('Do you want to remove the field %field?', + array('%field' => $field->title)), + 'admin/settings/profile'); + return $output; + } } function _profile_field_form($type, $edit = array()) { -- cgit v1.2.3