2

It seems like there should be a drush command to achieve this, but I cannot find one. I am not clever enough to fashion an SQL query that will delete all nodes owned by a user as well as clean up all the field and revision data.

Please let me know if anyone has any solutions (other than deleting the user's account).

Drupal 7

1 Answer 1

2

A possible alternative to achieve what you're trying to do, is to use a combination of modules Views and Views Bulk Operations (VBO). With these modules in place, you could simply create a view of all the nodes "owned" by a user, and simply use the out-of-the-box VBO action to "delete an item" (after adding a VBO field like "Bulk operations: Content"). And by creating a similar VBO view, using the VBO field "Bulk operations: Content revision", you can probably also cleanup up the revision data.

If you need more sophisticated business logic to decide about the criteria related to "owned by a user", you could add Rules to such solution also and implement a variation of the solution described in my answer to "How to bulk update select list fields?", i.e.:

  • Create a Rules Component with a Rules Condition to checks if the node matches the criteria you're interested in.
  • Create a VBO enabled view of all nodes to be checked, whereas you'll use the Rules Component as your custom VBO action.

Done ...

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.