Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If you have a field in the profile, and users fill in that field, and later that field is deleted all together, the entry in the profile_fields table is deleted, but the values for that field in profile_values aren't deleted.
Comment | File | Size | Author |
---|---|---|---|
#13 | del_profile_values_3.patch | 1.84 KB | Richard Archer |
#12 | del_profile_values_2.patch | 1.79 KB | Richard Archer |
#7 | del_profile_values_screen.png | 14.14 KB | Richard Archer |
#6 | del_profile_values_1.patch | 1.42 KB | Richard Archer |
#3 | del_profile_values.patch | 867 bytes | DriesK |
Comments
Comment #1
jmengle CreditAttribution: jmengle commentedFound where the field was deleted in profile.module and added a line to delete the field values from profile_values.
Comment #2
Uwe Hermann CreditAttribution: Uwe Hermann commentedCan you please provide a proper patch?
Comment #3
DriesK CreditAttribution: DriesK commentedThis is a patch of the db-cleanup code that jmengle added.
Comment #4
moshe weitzman CreditAttribution: moshe weitzman commentedplease provide big red warning to admins before they do this. this is a very destructive operation.
Comment #5
Bèr Kessels CreditAttribution: Bèr Kessels commenteda default confirmation should do, imo.
Comment #6
Richard Archer CreditAttribution: Richard Archer commentedHere's a revised patch that:
I shall attach a screen grab on another post.
Comment #7
Richard Archer CreditAttribution: Richard Archer commentedScreen grab of confirmation page.
Comment #8
Steve Dondley CreditAttribution: Steve Dondley commentedyou help text suggests making the fields hidden. How is it possible to make a profile field hidden?
Comment #9
Steve Dondley CreditAttribution: Steve Dondley commentedAh, OK, not hidden like a hidden HTML field. You'r talking about visibility setting in the profile module's field editing screen that says "Hidden profile field, only accessible by administrators, modules and themes."
I'd +1 this if you make that more clear and where this setting can be changed.
Comment #10
Richard Archer CreditAttribution: Richard Archer commentedHey Steve,
Thanks for having a look at this patch. And a BIG thank you for taking the time to work out what I was talking about in that help text :)
Here's a new patch that applies cleanly against HEAD. The old patch was hit by the new forms API.
I have improved the warning message that appears once you hit "delete". It now reads:
Are you sure you want to delete the field Example?
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 edit this field and change it to a "hidden profile field".
The text "edit this field" is a link to the admin page where they can change the type of the field.
Comment #11
Richard Archer CreditAttribution: Richard Archer commentedHmm... can't upload the patch.
I'll upload it here when the site problem is fixed.
But here it is, for now:
http://mel01.juggernaut.com.au/del_profile_values_2.patch
Comment #12
Richard Archer CreditAttribution: Richard Archer commentedPatch attached.
Comment #13
Richard Archer CreditAttribution: Richard Archer commentedHere's a new version of this patch that applies cleanly and fixes some code style issues.
Comment #14
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedLooks good, works as adertised.
Comment #15
Dries CreditAttribution: Dries commentedGreat team work guys. Committed to HEAD. Thanks.
Comment #16
Dries CreditAttribution: Dries commented