Cancel and delete users so content isn't lost

Created on 16 October 2024, 2 months ago

Problem/Motivation

The 7.x branch included #2971812: Use of cancel account instead of user delete. To allow the content to be set as anonymous. , but the 8.x branch just deletes the user. With a straight delete, Drupal removes any content created by the user, which is particularly problematic since the 8.x branch does have the option to not delete users who created content, as in 7.x #2800213: Add node ownership check .

Steps to reproduce

Have content created by a user that would be deleted by user_prune. Run the prune. Note that the content no longer exists.

Proposed resolution

Use user_cancel with the 'user_cancel_reassign' option, which assigns any content owned by the user to anonymous, then deletes the user.

Remaining tasks

I have code that is *mostly* working that I will post in an MR; it works fine when I am pruning by running cron in the GUI, but if I run cron via drush I get a "Route required" error that I can't figure out how to solve, and I'm hoping someone in the community can.

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇨🇦Canada kpaxman

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024