Problem/Motivation

If a site uses the Group module and the user being deleted has created group entities, those entities will be removed from the database.

Comments

alvarom created an issue. See original summary.

berramou’s picture

StatusFileSize
new77.55 KB
new116.2 KB
new172.38 KB

Hello @ alvarom
I can't reproduce this issue, i just tested with two users user1 and user2 belong to the same group.
user1 create an article in group, then i delete it and assign it's content to user2 that works perfectly see the screenshoots.

user deletion

group content

group content

Maybe some custom code or users don't have the right permissions.

berramou’s picture

Can you please provide steps to reproduce and it will great if they are on drupal fresh install.

alvarom’s picture

Testing with a fresh Drupal 10 install. I created user 1 and user 2.
I'm installing the Group module and creating content first before installing the module reassign_user_content.

These are the steps to reproduce.

  1. Install Group in your site
  2. Create group content with user 2 and user 1
  3. Install the module reassign_user_content
  4. Delete the user 2 and reassign it to user 1

Group content created with user 2 is now deleted.

This happens only with the group module. It works fine with Drupal content in /admin/content.

berramou’s picture

Ah i see thank you for those details, i will check this out!

berramou’s picture

The Group module implements hook_user_cancel and assigns all group entities of the deleted user to superuser.
I am unsure which approach is more pertinent:

  1. Avoiding interference with the logic of this module and allowing the Group module's implementation to handle the process, or
  2. Implementing the group assignment logic within this module as well, which, in my opinion, falls outside its scope.
berramou’s picture

  • berramou committed da543975 on 1.0.x
    Issue #3508211: Group entities deleted after reassigning user
    
berramou’s picture

at the end i went with option 2 i added the support of group module.
Thank you @alvarom for your contribution.

berramou’s picture

Status: Active » Fixed
berramou’s picture

Status: Fixed » Closed (fixed)
berramou’s picture

alvarom’s picture

This is working good now, thanks for the quick response and module update!

berramou’s picture

You are welcome, thank you for your report and details.