2

Is it possible to Delete the user and keep its content as created by the one who deleted the user.

Suppose, abc is a user as content creator/editor only and have created 2 contents.

abc got fired as editor and his boss xyz wants to delete his user account.

xyz not only wants to delete abc but while deleting abc transfer all the content created by abc to his name, so that it'd be like created by xyz.

Drupal has only 4 options while deleting user account which doesn't satisfy this need.

If it is possible then how? please elaborate how to achieve that....

2

While canceling user account choose either Disable the user account and keep its content or content belong to anonymous user

enter image description here


To bulk Update author for node you could use Views Bulk Operation

  • Create a view listing the content that you want to edit.
  • Add a bulk operation in fields

enter image description here

  • Select change the author of the content

enter image description here

  • Go to your view to select the nodes for which you want to change the author

enter image description here

  • Select the author who should be made the new other for all these content.

enter image description here

1

There is an option while deleting a user that Cancel the user account and keep its content.

To change the author you may need to implement hook_user_delete.

0

You can implement hook_user_cancel_methods_alter() to add your own cancellation methods. Add the cancellation methods using this hook, then implement hook_user_cancel().

In the hook_user_cancel implementation, you will be able to use a switch/case on the method selected and create your custom cancellation logic:

  • Load the entities
  • Change the uid for each one the user owned/created
  • Change the uid for fields pointing at this user
  • Save the entities

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy