Problem/Motivation
When a user deletes their account any Webform submissions they created while logged in will remain on the site, still tied to their now deleted user account.
Proposed resolution
Implement hook_user_delete() and provide an option to delete the user's submissions.
Remaining tasks
Implement hook_user_delete() to delete the user's submissions.
Provide an option on whether the deletion happens; some sites may wish to retain this data.
User interface changes
New global option to control whether the submissions are deleted.
API changes
n/a
Data model changes
n/a
Comment | File | Size | Author |
---|---|---|---|
#6 | 3171670-6.patch | 2.72 KB | guilhermevp |
#6 | delete_user.png | 10.9 KB | guilhermevp |
Issue fork webform-3171670
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
guilhermevp CreditAttribution: guilhermevp at CI&T commentedI was implementing the requested solution when I notice that drupal 7 has an built in option for deletion of all data upon removal of user. Don't know if I understood the request correctly, but seems to me an unecessary feature.
Comment #3
DamienMcKennaThat option in core deletes nodes, but I don't see any integration in Webform for deleting submission data, hence the request.
Comment #4
guilhermevp CreditAttribution: guilhermevp at CI&T commentedThe only way it seems possibile to remove all submited data from removed user, is to add an indentifier in the webform_submitted_data table, but it seems to be a intrusive change. Is it correct?
Comment #5
guilhermevp CreditAttribution: guilhermevp at CI&T commentedComment #6
guilhermevp CreditAttribution: guilhermevp at CI&T commentedSo, if I understood you correctly you want a toggleable option to delete all user data when said user is deleted.
So I implemented a menu option under advanced configurations of webform. When the option is checked everything from
webform_submissions
andweboform_submitted_data
is deleted.Comment #7
guilhermevp CreditAttribution: guilhermevp at CI&T commentedComment #8
Nishat Ahmad CreditAttribution: Nishat Ahmad as a volunteer and at Douce Infotech Pvt. Ltd. commentedI have check #6 and It's working fine for me.
Comment #9
Liam MorlandThanks for the patch.
I think webform_user_delete() should always exist and have the check for variable
webform_delete_user_data
inside the function. Otherwise, changing the variable will require a cache clear for the hook to become effective.Please post the patch in an issue fork. Let me know if you need any help with this.
Comment #11
guilhermevp CreditAttribution: guilhermevp at CI&T commented@Liam Morland
Can you review my patch?
I 'm not sure if the failed test is related with my submission.
Comment #12
Liam MorlandI don't think the test failures are caused by your patch.
Please check your coding standards. There are automated test tools.
Comment #13
guilhermevp CreditAttribution: guilhermevp at CI&T commentedThanks for the feedback! I'll look into it.