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

Issue fork webform-3171670

Command icon 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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DamienMcKenna created an issue. See original summary.

guilhermevp’s picture

I 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.

DamienMcKenna’s picture

That option in core deletes nodes, but I don't see any integration in Webform for deleting submission data, hence the request.

guilhermevp’s picture

The 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?

guilhermevp’s picture

Assigned: Unassigned » guilhermevp
guilhermevp’s picture

So, 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 and weboform_submitted_data is deleted.

guilhermevp’s picture

Assigned: guilhermevp » Unassigned
Status: Active » Needs review
Nishat Ahmad’s picture

I have check #6 and It's working fine for me.

Liam Morland’s picture

Status: Needs review » Needs work

Thanks 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.

guilhermevp’s picture

@Liam Morland

Can you review my patch?

I 'm not sure if the failed test is related with my submission.

Liam Morland’s picture

I don't think the test failures are caused by your patch.

Please check your coding standards. There are automated test tools.

guilhermevp’s picture

Thanks for the feedback! I'll look into it.