Allow admins to specify which account the content for a cancelled user is assigned

Created on 16 October 2009, about 15 years ago
Updated 4 December 2024, 17 days ago

Problem/Motivation

When cancelling an account, the only option to reassign content is to the anonymous account.

Proposed resolution

Add the ability to specify a user content will be reassigned.

User interface changes

tbd

Data model changes

tbd

Original report by hctom

Hi @all,

I'm not sure, if I'm too late for the API changes feature request, but I think it would be quite useful to tweak the "Delete the account and make all content belong to the Anonymous user." method for cancelled accounts.

It would be great to have an autocomplete field, too choose the user the content is reassigned to instead of always using the anonymous user. If the field is left empty, a default value should be used. This may either be the anonymous or a configurable setting value should be available for this.

Of course, this tweak for method may only be available to privileged users (e.g. with "Administer users" permission or even an own permission for this selection), so non-admin users with the "Select method for cancelling own account" may not reassign contents to other users by default (as this may be abused).

With this tweak site administrators may be able to set up a special account like "Deleted person" to reassign the content to. The may also reassign contents to the correct user, when two accounts need to be merged by cancelling one of them.

The corresponding uid may be transferred to hook_user_cancel() via the $edit parameter, so there is no need to change the hook's function signature. Only the performed queries need to be altered slightly to use the passed uid instead of 0.

So... what do you think about this proposal?

I'd appreciate, getting feedback for this.

Thanx in advance & cheers

hctom

Feature request
Status

Active

Version

11.0 🔥

Component

user system

Created by

🇩🇪Germany hctom

Live updates comments and jobs are added and updated live.
  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

  • API addition

    Enhances an existing API or introduces a new subsystem. Depending on the size and impact, possibly backportable to earlier major versions.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States euk

    +1 for this feature. Going to look at it.

  • 🇺🇸United States euk
  • 🇺🇸United States euk

    There is a module that attempts to solve this - https://www.drupal.org/project/user_delete_reassign , but it was not updated for a long time, has a few bugs reported and doesn't work for me with the view bulk op out of the box. Another considerations to be made - this should work with Workbench Access and similar modules. For that there should be a hook/event and validation system which would allow to alter username suggestions or validate new owner content access rights.

  • 🇺🇸United States euk
  • First commit to issue fork.
  • Pipeline finished with Failed
    13 days ago
    Total: 126s
    #362901
  • Pipeline finished with Failed
    13 days ago
    #362906
  • Pipeline finished with Failed
    13 days ago
    Total: 983s
    #363008
  • Pipeline finished with Success
    13 days ago
    Total: 1027s
    #363090
  • 🇮🇳India ramprassad

    I have created an MR 10488 for the changes related to this functionality. Please check

  • Pipeline finished with Success
    13 days ago
    #363113
  • 🇮🇳India ramprassad

    Unassigning as the MR is raised

  • 🇺🇸United States euk

    @ramprassad, you bit me to it =) Though I am currently working on creating a D10 patch, and there are a few differences anyway. I looked at your PR and left a couple of comments. I also have a few suggestions:

    1. I do not recommend storing a default UID for this new cancellation method in the configs: developers then have to maintain this config, while most of the time admins probably want to reassign content to different users (based on my experience with medium to large sites), therefore making this default setting irrelevant and annoying.
    2. Added to the above - if the account matching the default UID has been disabled/deleted - you would have to update the config and also might have to deal with consequences of assigning content to deleted/disabled users.
    3. When reassigning content, you should account for editorial permissions - is the new user able to edit content? The simplest way to check that the content belonging to the account being deleted can be edited by the new users is to compare roles and make necessary adjustment to the account suggestions in the entity autocomplete.
    4. Same as above should be also considered for multiple accounts being deleted in bulk - here you'd want the new user have all the roles the deleted users had, or let the admins know what the consequences are if there are some mismatches.
    5. There should be a hook/event allowing to alter user selection - some modules like Workbench Access have their own content permissions model and need to be able to intervene.

    I am including the above into my D10 patch. Hopefully will have it by EOD.

  • 🇺🇸United States euk
  • 🇺🇸United States euk

    euk changed the visibility of the branch 606824-allow-admins-to to hidden.

  • Merge request !10498Issue #606824: Added new account cancellation method. → (Open) created by euk
  • Pipeline finished with Failed
    12 days ago
    Total: 96s
    #363945
  • Pipeline finished with Failed
    12 days ago
    Total: 98s
    #363948
  • Pipeline finished with Failed
    12 days ago
    Total: 507s
    #363949
  • 🇺🇸United States euk

    While D10.3.x. merge fails (specifically - unit test, though it shows 100% success rate), here is the patch for D10.3.x - should work with 10.3.6 and up, till 10.3.10 at least.

  • 🇺🇸United States euk

    Adding updated patch for 10.3.x

  • 🇺🇸United States euk
  • Pipeline finished with Failed
    9 days ago
    Total: 552s
    #367957
  • Pipeline finished with Failed
    9 days ago
    Total: 111s
    #368109
  • Pipeline finished with Failed
    8 days ago
    Total: 490s
    #368167
  • 🇺🇸United States euk

    A few more updates to the 10.3.x patch.

  • Pipeline finished with Failed
    6 days ago
    Total: 417s
    #370288
  • 🇺🇸United States euk

    Minor fix to the 1.3.x. patch.

Production build 0.71.5 2024